logo

NJP

IntegrationHub and the Emergency Response App

Import · Sep 02, 2020 · video

hi i'm dave slusher with the integration hub team at servicenow in this video i'm going to walk through the creation of a flow that integrates a servicenow instance with various systems in the outside world to create some unified business logic the plan for this demo is to accept an inbound email then to examine that and to see if this is in english if not then translate the subject and the body text create a record in the emergency response app inside servicenow if the translated subject contains the word positive then we want to start a zoom meeting post the link to that zoom meeting to a slack channel and then annotate that created record in the emergency response app with this information to accomplish this we'll use the following spokes we'll use the ibm watson translation spoke the zoom spoke and the slack spoke the ibm watson spoke is one of the three translation spokes that we have available we also have microsoft azure and google translate available for those who need them i actually chose this spoke specifically because it's the easiest to set up but in terms of availability and quality of translation all three are roughly comparable so if you would like to duplicate this or a similar type flow watson has the lowest barrier to entry there may be other considerations for your particular use case all right let us begin so first we're going to create a new flow and let's name it covid self report we'll make sure to create it in the global scope although you can pick different ones from this point and then we're going to add a trigger to it and that trigger will be the receipt of an inbound email action so we're going to filter a condition and that condition is if the subject contains uh the string covid now you can see since part of what we're doing is translating we are assuming that that string is in english in the condition we can't do the condition based on something else at this time the first thing we're going to do is create an action that will detect the language and so we'll use the body text of that inbound email as the corpus for the ibm watson to determine what language the email was authored in so the output of that is going to be the two-digit language code then given that what we're now going to do is first start with the subject of the email and we're going to translate it to english and we're going to base it off the source language which will come from that detected language now note if both of these are english this is kind of like a no-op we could also add in some branching logic but we're not going to in this case so we're going to also do the same thing for the body text of the email so we'll select that from the data pill and drag it over and we'll do the same thing we'll set the target language to english and we'll set the source language to the detected language now given both of these uh translated bits we're going to create a record and so that record we're going to create is the crisis task record that's in the emergency response uh app that servicenow has recently published so we're going to pick the fields that we want to add to this record we're going to pick short description which will be the first bit of translated text i tried to do them in a sensible order here so short description and then we're going to add the description so the full description is going to be the translated body text so that is from our step three and you'll note that we can just drag that we can also use the um the little cannonball icon to the right but in this case i'm dragging it we're going to add some fields we're going to add a field for the person which we will get from the user record of the person who sent the email and then we're going to add one hard-coded field here which is we're going to pick the choice of the health status and we're going to say if it came from this email it's always a reporting symptoms so it's kind of assumed if we're in here that's what it is now we're going to add one more bit to associate that record that we just created to an email so we're going to to we're going to tie those two together and we're just going to do that with drag and drop we're going to drag the email record and the newly created crisis task record and now the system knows that this record was created from this email and it can route future emails to the correct record now we're going to add some flow logic in here we're going to create an if and an else branch and what we're going to do is to trigger this based on whether um there is the the stem positive in the translated text of the subject now this is kind of a demo situation this you know you can poke holes in how robust that is but for the purpose of this demo that's what we're doing there's you know obviously some uh some ways this could be tightened up but this is so that we can demonstrate kind of how this works and you feel free to kind of swap out what you think would be a better a better branching logic for this and we're going to add an else branch i'm going to go ahead and do the else branch first because the else branch is fairly simple and we'll just get that out of the way and then not have to think about it all we're going to do is if we're in the branch for the person not testing positive we're just going to send them an email with some resources around our covered response so we're going to send it to the email of that user so we're going to essentially get the email address out of their user record we're going to reply to that email address and we'll have a hard-coded subject line and then we'll just have a email body that would have some links to resources so we're not actually going to fill it in but this is kind of what it would look like here are some resources and then we would have a list of that and so basically everyone would get the same email so that doesn't take a lot of thought all of the rest of this is where the complexity is going to lie if they did actually test positive then we want to do some more things around that so this is when we begin to really start integrating off system and so we're going to get into the integration hub part of this and you can see all these spokes that are on this system for integrating with other systems we're going to the zoom spoke and we're going to create a meeting and so the first thing we're going to do is pick the user id um for demo purposes this is not a servicenow uh slack channel so you'll see that that's uh you can email me there if you want and uh so then what we're also going to do is we're going to add the start time and that's specifically because i found that if that's not the start time is not there then the zoom integration is a bit quirky so what we're going to actually do is um we're just going to make it be now and so the way we're going to do this is just return a new glide date time in that function field so you have the ability to write some javascript and then the result like the return value of that function is then what gets filled in the field so now we're going to add the topic and we're going to show how you can use those data pills interspersed with text to create um some of these fields so we're going to say it's the covid response 4 and then we're going to pull the name out of the user record of that person who create sent the email which because i sent the email you'll see later on it's my name and then we're also going to get the created time out of that email and we're going to uh include that in there so this will be the topic of the zoom meeting and so let's open up the email record and we'll get that created field out of that so now you can see that it's going to dynamically fill these in based on the values at runtime so when this actually runs it'll look at the email it'll figure out the user and it'll start to fill that in so now we have this will go out this will go to zoom and create a meeting so now we're going to do the next part of that where we're going to take that value and we're going to pass it on to slack so we're going into the next integration and we're going to post incident details to slack now this works because um that crisis task record extends incident if it didn't it could be something else it could be task or it could just be a record because it's an incident it has some defaults and so um we're just gonna leverage that we're going to post it into the channel id emergency response which is set up on the slack that is configured for this system for the incident that is the record that we have created again which is of type incident because it's crisis task extends incident and then we're going to uh add an additional message now this one is kind of cooking show already created i'm going to paste it in here and you'll be able to see that you can see how the output of the zoom would be a little nicer if it was data pills that we could use in this particular case it's kind of like a json object so even in that case we can still use this so as you can see that fdata.61 create meeting that is the output of that particular step step 6.1 and so we're going to take that json object and we're going to get meeting which is the zoom and we're going to get the join earl and we're going to get the username out of the trigger and we're going to use all those things to create ourselves a little uh message a new coveted case has been recorded for username and then it will have a link to that particular url then what we're going to do is override some of the default fields the username that we're going to post it as is covet response and we're going to also create a custom icon which is uh which is in the slack format if you want to use one of the icons that has a short code you can use it here and that will actually then be the icon for that message when it is posted to slack so now that part is going to slack we're going to do a little bit more which is we're going to now go back to that original record and we're going to annotate it with the zoom message so we're going to go back to the servicenow core spoke and we're going to update the record so we'll get the original record and so you'll see the table will be automatically filled when we drag it in there because it knows what type that uh that record is and now we're going to update a field and the field that we're going to update is the additional comments so we don't we're not updating any of we what we want is just a new annotated entry that says by the way a zoom has been created for this and so we're going to use similar script that we used before because we want that uh we want that url in there so we're formatting it in html format so that is actually a clickable link inside servicenow and now that we'll write that back to the record that we created so we're kind of closing the loop on this business logic here so now you see what we've got here we're getting the original email we're detecting the language we're translating we're creating the record we're associating the record if positive then we're creating a zoom we're posting the zoom to slack and we're updating the record so you can see that we've actually reusing if you count the email system we're using four different systems uh email comes in and then we do things in servicenow and two external systems so you can see that there's a lot of business logic that's happening here so now let's see this thing in action we're going to test it so i'm switching over to another system so that you can see my slack so now we'll test it and in the testing that allows you to pick uh records on there so we're going to pick the two there are two sample records that have covet in the title so we'll pick this one it's in spanish so we're going to run the test it's going to take a little bit of time because ideally you want it to not come back in a quarter of a second because it is actually going out and hitting external systems so the first time you test one you want to see a little bit of time but not too much time there's a sweet spot we've run the test so if we go back to the main system let's see did we create our record in the health records and we see that we have a reporting systems record and there is the translated description and the translated short description from uh what it got out of the translation if we switch over to slack you will see that we have posted the slack record that we wanted to post including a link to that zoom so if we click that link to the zoom it will open it up and we will see it's waiting for the host to start but the record has been created you see it's got the uh it's got the topic that we wanted to have for it with my name and the time so now let's go and test this again but with a different language so in the situation that we're kind of uh simulating here you might have a worldwide company in which the reports may come in a variety of languages and we want to coalesce them and funnel them into english for let's say it's an english-based team that's that's handling these so uh i could i could conceivably get out spanish i cannot get out telugu so like in this case i don't know anything that's being said in this email so let's see what happens when we test this one out so again we'll run it it needs to take a little bit of time you know starting with the translation bear in mind that we're actually calling three different translation apis and yet so you can see in this particular one we did not get have the positive in the translation but we did get the translation and so you can see that this is what that said i'm afraid i have covid i think there's probably a shaky translation right there but you can see that it works even for non-roman languages it should work for any of the supported languages by the translation engine that is in use so in summary what did we learn from this demonstration we learned that servicenow can be the central point for all the business logic that you want to happen are regardless whether it's happening on your instance or whether it's happening elsewhere flows can be the source of this business logic and using integration hub they can control business logic in other systems these flows can be authored with little or no coding just a few lines of javascript were all we had in that the rest was drag and drop and then the logic can be maintained by the organization that owns it and understands it in our particular case it could have been the hr organization or whoever was administering the emergency response rather than them communicating to development their business needs getting a solution and then iterating that way they can just build it because it's simple enough using flows and using integration hub that you don't require a developer organization to create this logic so with that i thank you for your time if you have any questions about what you've seen here if you're trying to replicate any of this if you need any help with that feel free to reach out my email address is dave.slasher at servicenow.com thank you for your time and happy building

View original source

https://www.youtube.com/watch?v=tZg61_sdZY0