Outbound Integration. Code365- ServiceNow
so in this video what we are going to do is actually the first thing we are going to I'm going to demonstrate how we can create a user in service now and as well in code 365 which is my website which has a MySQL database okay so we do have your registration form once I complete this form click on register it's gonna have a user instance now and as well it's going to insert some data into the master database so let me first show him the user that I'm going to create I'm gonna check it that Musa reasons existing user or not so I'm going to go right here so this is the user table ID for example as you can see here it's completely empty I do not have any user right I'm going to do the same thing for the table that I have for my for the website so I do have a database the database name is code 65 and I have a person table and as you can see here I have certain columns first name last name user ID email password but it's completely empty there is no row a record inserted in here so let's fry let's try now to free the forms on register let's wait a bit I do not have any messages any pop-up but we can check now in the user table something as you can see here I do have a user created so these are the information that we have just entered into the phone so I have the user ID the first name last name email and so on so let's check now if I have something into the database which I have for the website so let's click on person table and see if we freeze there have something so as you can see here I have exactly the same information so at this point we do have only one single entry point but the data is inserted in two different database one in service now and the other one is in code six five which is my website so how we can make this thing happen so let's see a little bit what we have behind this form what is the architecture so let me click here so these are the different features of let's say the registration form what we have behind it which is allowing us to create the user in two places at a time okay the first thing I have a client script which is going to call the table API of ServiceNow and the transcript have all the data in this a which means the first name last name is our ID and so on so it's going to send these information to the table API to create a user record in the system user table this is the reason why I have this report in here as at first point at the first thing that is that is what we are doing we are creating a user in service now that is a first step and after that we are I'm having in ServiceNow flow the flow which is triggering whenever the user is created in the seats this is a table you're going to trigger that flow and that flow have a specific action step so it is they may be tail we call from the transcript they differ in Bourne integration may be made a rest call to the table API and then we create the user and here once we have the user recall all the information right here or you're trying to achieve here is to have send our bone integration send a rest request to go 365 API where I have as we have a table API I do have another API which is create user API which is created for this website specifically written in PHP and I'm sending all the data to this API which will be creating the user I mean it will be inserting the data into the MySQL database this is the whole thing behind what's happening when I'm clicking on the registration small so let's see now how we can create the flow how we can click what we can how we can do sorry how we can do the PowerPoint integration and how we can create the flow in the flow designer in order to be triggered whenever a user is created okay so that is the part mainly we can work on service now these are the things that it is a little bit out of scope so these are user API is written in PHP language and this one we already saw in previous videos how we can make a bone integration you know external client spread with the JavaScript language and called ServiceNow API okay so let's let's get started the first thing I'm going to create an action so make sure they go to flow designer click on you click on action and I'm gonna the first thing I'm gonna have input okay great now you're gonna create a payload so I'm gonna send the requests in the request body which will have to pay payload so all this information the user ID first name last name email password it will be in a payload so I'm going to create a payload so this is a builder and the first one is going to be the user ID so I'm gonna just drag and drop the data that I have already here in the input variable so whatever the value that I am going to enter in the beginning so will be will be stored in the payload with this name contest we can see I'm gonna do the same thing for the rest of the right so they have done this part and now we're gonna make a request a rest album request so I'm going here integration pressed make sure you choose define connection in line I'm gonna provide the base URL which is this one so basically it's a folder another folder is a folder another PHP file which we'll be inserting basically when it's going to get the payload so all this information and it's going to take this data and then create a call into the database okay so here choose post and you we have to try perfect so now what I want as well is part of the response I do have in this page b5 which is actually taking the data trading user into the database but as well have a response once it's created a user I would like to send a response say the status Corrie will be 200 the record is created invalid status code 500 so on so I want to have this response as well I want to see it here in the flow designer when I'm going to make a test ok the first thing here I'm gonna create two variables the first one is going to be the status quo okay right here and the inputs status code in the input that I have and the status code that if R is equal equal to 200 I mean in this case it's successful that's how the code is written into the PHP file and I'm gonna do I'm gonna parse the response by okay so I'm going to create body this is and here inputs the next thing we are going to do is having output variable outputs and we'll have the message like the record is created so the code that I've wrote into the PHP file I like this one have response message which is record is created very successful so I won't get that message so it is store on a specific variable that I'm going to mention here it's going to be response Tory and access right you perfect so now what we are going to do is to create here okay okay so let's no wait let's test now so I'm going to input some values here and then see if it is going to create a call in here in my so that's what we are going to try to do right here I'll put it for example our user ID first name here so you have something wrong here as one's body is not defined you you even though I didn't get the proper response message because I have made little mistake in here in the cold but I guess here the request was sent properly so I want to check here let's see if I have something so as you can see here a shell almost and I do have the user created with the password that I mentioned as well I have all the information first name last name user ID email and the password this is the first part that we have done we have done the action step we have made outbound request not to create a user into the MySQL database and now what we can do additionally is to I can show you how we can create the flow which will be triggered whenever user created okay so all we need to do is pretty simple from now is let's go back here this this is my flow I mention here like when you have to trigger this flow when the record is created in which table since user table okay so it's right here so that's the first part once you once you have once we have a user who created this flow with a trigger and then you're going to add an action in our case we can add the action that you have just created so I'm going to publish this one so otherwise I cannot find it here so if I click your action what's name see I don't have nothing so what I need to do at this point is to publish this one you you okay so let's go back here it's an action this okay as you can see here this is our action so I'm gonna add that one and you can see immediately if we do have all the inputs variables user ID first name last name email password so here we have to mention that you're actually creating you whenever we create a record so when a record is created we do have all these fields available for us so user record we do have the for example email first name last name and so on so we just need to drag and drop so whenever we create a record all this information that we have in the user we call we have to just drag and drop here I hear the corresponding fields so I should find out here the user ID is right here and then I'm going to same thing email you you okay you have all these informations that you come done I will check you you you okay so we are going to do I do have another flow which is actually basically allowing me to create the user whenever I'm going to whenever I'm checking in this form right so I'm gonna these activate that flow so let me find out one so here is going to be crazy this one which I temporarily I'm gonna exactly and we're gonna use the one that we have just created so I dis activated the flow which allowed me to whenever I'm going to click on register' to basically how to say trigger from you get the user record and execute the action step and insert call the creatives or API finally so I decide to baited the one that I have created before and now we are going to use the one that we have just created okay the one which is this one which is activated so let's now create a user [Music] okay that's it let's see if is going to create now into the my school database if I'm going to have let's see what I have here so for now I had rain and Russia I should have now the user that I have created inserts now which is we create a have in here okay so just and as you can see here I do have the user created as we created in ServiceNow directly it the password is encrypted if I create from you for example going back here it won't be the case I'm gonna just refresh the page and I'm going to create [Music] password click on register and see what's let's go in your first check and as you can see here I do have the information so it's perfectly created interest now from here let's see here if I have something and I can see here I do have the same information but the password is not entered into this field okay so if you create the user directly from so it's not will be encrypted but not from here okay so this is how we can enter use code physics for here as a single entry point and store data in two different database okay so thanks for watching hope you enjoyed bye you
https://www.youtube.com/watch?v=Had0CnAHJ74