logo

NJP

ServiceNow – Detect Languages in Incoming Emails

Import · Jul 27, 2022 · video

hmm how can i detect languages in text well i could use google translate but i can also use servicenow from the san diego release and i can take advantage of this feature in my own business processes that i built for example with flows using flow designer let's take a look at an example so the use case i'm going to demonstrate is when an incoming email in a particular language is received we want to be able to detect that language and then use that as the basis later to maybe find the right person in our group to work on that instant who speaks that language so in preparation for this demonstration i've got an incident form here and i've got the skills field displayed here if you open it i've got a few languages here so you can put in languages here manually as well as some other skill and if i go to my skills table i've got a whole bunch of languages here listed note also that i've also got the two letter code for each of the languages which i'm going to refer to in the flow that i create in addition i've got a couple of emails here waiting to be processed uh i've got one here in german and i've got another one here in swedish and they've got a body as well just with one or two lines in there and that's actually what we're going to be using to detect the language is the body of the email so let's go ahead and create the flow so i'm going to come to servicenow studio i've created a simple app for this to contain my flow so i'll go ahead and create a new flow and i'll just give this flow a name and i'll put in a description as well okay so my trigger is going to be inbound email for this demonstration i'll just add a simple condition here where the subject contains that there so my two emails have that localization code in the subject i'll go ahead and save it and now we'll go ahead and add an action the action that we're looking for is called the tech language it's the one under dynamic translation here so detect language you can see it's got a couple of inputs one being the the text so we can go ahead and drag and drop the body text from the email over and the other import is a translator now i'm going to put in servicenow here and then save this flow and come back to my instance and i'm just going to open up a list here called translator configurations now if you have dynamic translation activated you'll see these three here they are provided out of the box uh what i've done already is activated the one for service now this wasn't activated before so all i did was check this box and now we can use that service in our translation and maybe before we go any further we can actually test this action so if i come to my list of actions here again open up the one that is in the dynamic translation spoke you can see it's got these two inputs that we just saw and it has a script there to do the heavy lifting so if we go ahead and test this with some sample text thus here is alf deutsch this here is in german specify servicenow as a translator run the test view the execution details and if we scroll down we can see the outputs from this action though what we're really looking for is a language or language code and this is contained in the detect language output data here so if we open up this we can see that the language detected was german and we've got a pretty high confidence there that's pretty close to one so in other words very confident that this that text was in german so if we close that and go back to our flow so now we're in a position where we can develop our flow but before we go ahead and create innocent we need to do a lookup of the skills table using the language that we detected from the detect language action so i'll go ahead here and do a lookup record under servicenow call sometimes there's more than one with the same name or a similar name so just make sure i get the right action the table will be the skills table i want to do a lookup based on the name and i'm going to select ends with here because all my skills or my language skills and my skills table actually end with the two-letter language code so in this case it's very simple here with this ends with operator and then i can just drag and drop the detected language not this data pill however but the one underneath it the code here just drag and drop that here okay so now that we've got that we can click on done and go ahead and create our incident so in this case i'll select create record and now you can just populate the new record as you normally would with this action so i'm going to select incident and then populate the following fields the caller the short description the description and then the skill where i'm going to add the language skill that we've found in the action number two here this lookup so the short description or the caller in this case will be the user record that we identify in the incoming email the short description will be the subject the description will be the body text and then finally the skill we'll need to pull from our second action our lookup record here where we actually uh find the not the skill record but we need to just get the name from that record and put that in there and that should be it so if we go ahead and test this now we should find hopefully that it works let's go ahead and save it before we do test it now again i'm going to test this using the emails that we've got here in this list both of them begin with l10n so i'll just take this one as an example i'll take this one first in german it is the zika heights varnong subject so we'll go ahead in our flow and select that email this one here run the test and let's go ahead and have a look at the resulting incident that we created so we've got incident created let's open it we can see the caller is populated the short description is there the description is not here because i haven't displayed that field but i'm pretty sure it's there but importantly we've got the german de as the skill set for this instant and as i said we can now use this perhaps as the basis to assign this to the right person in the team who has german language skills let's do a second test now with the swedish email i'll come back here and select the second email the seco heads varning incident run that and again come back to our incident list we've got a second instant created excellent and if we open it same data in there except the skill now is set to swedish because it's detected that as a language of the email so there you have it a way to easily detect a language of an incoming email using dynamic translation and do with that as you will but here this is a pretty typical use case where we can use a language for assignment purposes but you could use it for any other purpose that you wish so thanks for watching and see you next time you

View original source

https://www.youtube.com/watch?v=I-Q1w_xCsEc