logo

NJP

Automate Record Creation in #Salesforce from #ServiceNow

Import · Mar 01, 2020 · video

Aloha everyone so in this video what we are going to do is to create in service now and as well in Salesforce I mean by here is in Salesforce we're gonna have a very simple application it's going to be online school management application I don't have yet any data model I'm going to do it I'm going to do it from scratch I'm gonna we're gonna have few tables but in the beginning when I have only one table okay so I'm gonna call it language mingle and we're gonna have two two table student table language table or any other table that we may need in future but in the beginning when I have only two table so we're gonna have the same application created in service now we're gonna try to integrate both application which means whenever I'm gonna create a record in service now is gonna automatically create a record in Salesforce so so what we need to do for that is to know integration up we're gonna create connection and credential aliases that we are going to do in our flow use it sorry in flow designer so we're gonna have a flow in the flow we're gonna have a trigger like whenever a car is created on that particular table please check out this flow okay and that that flow we're gonna have create record in six code for that application and for that custom object so custom object in Salesforce is a equivalent of table in service now so here this is the part that you get whenever when you have your Salesforce instance developer instance and here you have to go to app manager and I'm gonna create a lightning app so I'm going to click on lightning app so I'm gonna call it language Mingo okay so I'm gonna get automatically a developer name you can enter here a description is going to be an online school management application we can use a you want to have some kind of picture you can upload a picture so I'm gonna select this one I'm gonna keep it like this the background color is going to be blue and we're gonna keep it the settings for the unification and form-factor all these all these settings I'm gonna keep it as it is I'm not going to add any utility item here and here we can add all the accounts sorry all the different tabs that you can have for your application you can have account assets so these are all created for you so you can just use it if you need this for your application so it's like already created tables with custom fields and like for example you have the calendar we have for example contacts people so if you want to use the applicator the table which is already created you can just select it in our case we are not going to use these tables we're gonna create a new one and in this part we cannot create a custom object without a spreadsheet so what I'm going to do is not select I'm not going to select anything so I'm gonna click on next and here make sure that you select look for a system administrator and this person is going to have the access for the application so system administrator so I'm gonna save it so it's very quick very simple we have already created our first application if you want to look at the application click on this icon here look for language I mean girl you should have navigation popping out here okay okay I'm gonna refresh in a bit okay as you can see here we have long integer is the application that we have created I'm going to show you a little bit how it looks like so it's very empty we have nothing here we don't have any tabs so we're gonna create progressively our the tabs when I'm talking about tabs these are tables our custom object so I'm going to create a one custom object which is going to be a Tudor custom object it's the Tudor table so I'm going to be back here in the set up for object manager and you can see here account is a is one object we have asset we have badge we have campaign and so on we're gonna create a custom one I'm gonna click on create custom object and label is gonna be the tutor so the same thing with passing the end for plural label and what else I need to select here so I'm gonna keep it here I'm not allow search and also launch new custom tab is after saving so I'm gonna save it so in this part I'm gonna select what kind of style that the tab going to have so it is going to be a tutor so I'm gonna select something like people here so I'm gonna select this one the rest I don't need to touch so I'm gonna click on next so it's going to view this what type of user was going to use view this tab okay so this is going to be I'm going to keep it for system administrators so everything is default on I'm gonna click here sorry I'm gonna click here I'm gonna put default off and then I'm gonna say like this one on and then click on next okay so this is like the visibility as well for the application so I'm gonna deselect everything and put for only language Mingo okay so we have created our application so we have now we can configure the application we can create fields and page layouts button links and so on we're gonna first start to create our fields it's going to be three maximum three or four fields first name last name and so on we have already few fields created for us by default so to do name is like the first name and last name together let's say and we have few other fields like first name last name city for example so I'm gonna great tremont fails so the first one is going to be the first name I'm gonna select here text click on next and I'm gonna call it here first name okay the length is 40 this is the database name okay so as we have some similar thing in 6 now so required it's going to be always required click on next and I'm going to keep this settings and I'm gonna say save new so I'm gonna create for last name now so here I'll click on text okay sorry always required value click on next save new and this time is going to be another text and we're gonna have city okay great next and I'm gonna save it okay perfect we have now created three different fields so we're gonna have four fields together first name sorry first name last name to the name and the city okay so let's see how it looks like in our application so I should have a tab to the tab under 2-to tab I can create a new tutor so let's look for language mingo hope I'm gonna have the tab so I don't have any items here that's because I have forgot to do one thing which is I have to do some configuration on the app level so I'm going here app manager look for language wingo edit navigation item and right here okay so this one I should add as a tap okay so I'm gonna add as a item available for us so I should now have something but sometimes it takes like two three minutes to have it here so what I'm going to do is just I'm gonna disconnect and then connect again okay so make it a little bit faster I'm going to close this one let's see if I have something now okay so let's let's look for language here okay and see I'm going to have great I have the tube top and as you can see here there are no teeth created I'm gonna create a new one just for our testing so here didn't name let's say John Doe right so I have the record created so as you can see we have one record and we can see the details here and in future we can have multiple things we can have a highlight panel here we're gonna have custom links buttons related fields much more things here and also much more tabs we have money to tell we're gonna have student tabs we're gonna have language tab or other tabs that we need so in order to make sure that is this application is working properly okay so let's move on we're gonna create the same thing I'm gonna have the same thing in service now so one table with the with the application and then mainly we can work on creating connection credential laces in the integration of back to ServiceNow so what we are going to do here is to create Salesforce connection and credential yeses and before even doing that because we are going to create that because we are going to use in our flow designer so this is going to be our connection in our flow designer before even doing that we need to create a connected app so that part entirely I explained in a previous video how to do how to enable what configuration how to create this application service now app connected app and I not to get the credentials and also provide the redirect I'll for this application you do the same thing I mean doing the configuration or configuration in service now that part need to be done before even creating a connection grant siliceous okay so let's get started so I'm gonna click on you and it's going to be say force yes okay I'm gonna name it like this I'm gonna keep it to grow Global connection in cadential the rest I'm gonna keep it the connection type is going to be HTTP submit so I created that now I'm going to create a new connection on you and I'm gonna call it okay here I'm going to put the base URL so which is this one okay and here I'm gonna create the credential so I'm going to just select I'm gonna want to create the we have already created the oauth2 five okay so I'm going to just select that one I'm going to click on you look for hot so I'm gonna click on that I'll give it the name here I'm gonna put Salesforce Oh what okay so I'm gonna select the profile okay see it's also a default profile this one we created when we do the configuration so it's not for what okay and submit okay this one is done I'm going to submit it okay we have done our part let's see now if we can so we don't have the access token so I'm gonna click on open record and then get our token great so if you have done our credentials so let me show you a little bit the application that I have created which is very similar to what we have so I'm gonna click on create new so first name last name City and teacher name okay this is the one that we have in our Salesforce application the same exact field and we have here the number their card number in service now and we're gonna have some sort of ID for a six-horse okay on the other side okay the next part is going to be doing the configuration sorry creating the flow in flow designer a few steps and and we're going to use our connection credential okay so this is the part where we are going to create a flow and action you know the army the recuperation process ok record creation step so we're gonna have a record created in ServiceNow in the table t2 table and it's going to automatically create a record in our to the table in Salesforce the first thing we are going to do is to create an action in flow is I know somewhere I'm in the flow design or application and so it's now so I'm going to click on new action I'm gonna give a name here so it's going to be for example create tutor tutor record ok the application I'm going to keep it from our global summit so we're gonna have four input so those input is going to be related to the four fields that we have in our two tables so we're gonna have first-name lastname name and City so here name another one is going to be first name okay another one is gonna be last name and we're gonna have city okay this is these are the fees that we have in our t2 table as well in our service now to tutor table as well so the first part we have done our inputs now we're going to create a payload using payload Witter so we're gonna have here four variables which will which will have the database name of the change of tables that we have in Salesforce okay what I mean by that here you can see this is the object manager we have the tutor detail so and details we have the API name for the to two table tutor underscore underscore underscore and see I do have the same thing for all the fields that we have created we have played city first name last name and we have already twitter name by default so this is the database name city and a school and cozy underscore and cozy and for first name last name and so on falling so we should use these naming standard in our flow designer so this should have for example name I'm gonna pick the data name here I'm going to drop it here and I'm gonna have three others so I'm going to just copy paste for the first name and last name and also city okay so I'm gonna just drag and drop first name here last name here see so as you can see here we have our payload this is their this is the message that we are going to send to the by with my sister request body okay so we have name first name last name and so on without the database name for the tutor table and the value that we gonna enter okay when I'm going to click on test is gonna give me four input variables which will have the data that we are going to enter right so we're gonna have the name here first name last name and and city so the next step is to send the request to send a rest request so I'm going to click on rest here I'm going to use connection a yes that's what we wanted to use before so what we used right so we're gonna click on connection yes I'm gonna select Salesforce I guess so that's the one that we have created as you can see here is automatically selecting the page URL so I'm going to put here the resource pad the remaining URL I mean the complete URL which is where we are going to send the rest requests okay it's going to be the base your plus their suspect so I'm gonna take that one from here okay and you can see here we have the tutor tutor table database name okay this is the entire URL to send a rest request to a custom table so if you're using another naming for your table you just need to replace by the database API name here okay it's going to be a post method I'm gonna have an editor what type of content that we are sending so it's a JSON content so I'm gonna have content type here right here is going to be the value is going to be application Jason okay so here we're gonna have our payload so I'm going to just drag and drop this one I hope is gonna take it if doesn't work I'm gonna use I'm gonna do like this great so this part of it is done so I'm gonna do for I'm gonna go for the next step which is a writing the script and this curve is going to pass the response party and what I want to output is the ID or the recall we create in Salesforce so we do have kind of sis ID for the record we create in ServiceNow in the same way we will have an ID for the record that we create in Salesforce for example I'm going to show you one thing very quickly so I'm going to be developer Salesforce okay and I'm going here integration API examples Oh God and as you can see this is the type of response body that way that we get okay and as you can see we have ID when we send a request to a certain URL to create an account so when we create an account we get a response body and we do have the ID so in the same way when we are going to send a request to create a tutor record in Salesforce we're gonna get an ID so that's the information that I want to output okay that I want to make sure that I have this information so I'm sure that is a record is created okay the first part here is creating two input variables the first one is going to be the status code okay the second one is going to be responsible okay I'm going to just drag and drop the data field that I have here which will contain the status quo and this one will contain the response body so we're gonna pass the response body and take the ID out okay so I'm gonna just use the script that I already wrote for previous integration it's going to be pretty much the same thing the only thing that I'm changing here is status score as you can see here instead of having 200 usually it's 100 it's mean and successful 201 successful but you have created a record on the other side and I'm crossing the response body I'm taking the ID of the response body that's why I'm using response body dot ID this ID is related to the response body that we receive from Salesforce okay here I'm going to create a variable which I'm going to call similar to the one that I have here SF ID okay and let's say now I'm gonna just create an output variable when I'm going to test the result and I see the execution details I would like to see the ID somewhere so I'm going to create as well ID here great and a mode and put that here so let's see now okay let's see how it's going to work or not so I'm going to click on test and create a car Bryan okay see what's gonna happen now okay I don't have I don't have any output so let's see what what happened in value session ID so which means I should get your token one more time so let me go here and look for sales for connection potential and I click here even though I have a token sometimes we have to kind of reinforce I'm gonna get another one more time or token and see what's gonna happen so I have no other token and then we're gonna send one more time the request okay as you can see now I do have the ID which means there is a real car created successfully in the teacher table so let's check that here so I'm gonna refresh the table I should have Brian Tracy so as you can see here I have Brian Tracy in the details I have the tutor name I have the city okay all the information is properly inserted in the appropriate field so at this at this part of the video we have just done created the action we have to kind of automate the entire part which means when I'm going to create a record it should trigger this action okay you should go for this action so I'm gonna create a flow so click on new I'm gonna create a new flow I'm gonna put create so this is my flow which is going to have a trigger the trigger is going to be when you create a record on a specific table so I'm going to choose the table here it's going to be to the table and I'm gonna come down and I'm gonna add the action that we have created so I'm gonna look for global and I should have create okay I don't have that's because we haven't published it so I'm gonna click on save and publish it okay now I should have had the action so I'm going to global okay I don't have here and I'm gonna give all the feeds that I have in my table has an input here so I'm going to just click right here click the data piece that I want so City for three and then go for first name last name gonna be the to donate okay great so I'm gonna save it activate it okay so now let's see now we're gonna create a record in the tea table from the table inserts now so I'm going to look for teacher application so language Moodle application and for the table teacher and then click on create new so I don't create for example okay summit so at this moment it should automatically trigger the flow perform the action and then we should have a record create automatically in Salesforce okay so let's see now if there is if there is any execution details I want to click on execution here and we have one execution which is properly done and see what is it okay is it the same thing so this is Alex Peter at expiry of Harris this is the one that we have done right now so this is the execution so let's see now in Salesforce if we have something okay as you can see here we have the recall Alex Peter okay Alex Peter first name last name and the city this is because this is done automatically so whenever you're gonna create a record here a new record each time is going to create a record automatically in Salesforce we know do another one let's do for example Jack [Music] let's see if we have this record right now okay so we have crater here and let's go to our Salesforce click here so maybe it's going to take some time I'm gonna refresh refresh one more time okay as you can see now we have the record created within few seconds like around five seconds we have automatically the record created in Salesforce that's it for now and I hope we're gonna create more tables here more custom objects like students lessons languages and create relationship in between tables and create a workflow as well and see how we can submit a request from student student submitting a request to a tutor I wanted this particular lesson for that date and it's going to either approve or reject this is the entire the intention of during this application all right so thanks for watching hope you liked it bye

View original source

https://www.youtube.com/watch?v=85RvEcQGnXI