logo

NJP

#5 What is Display Business Rule in ServiceNow | End to end Tutorial of Business Rules in ServiceNow

Import · Sep 15, 2020 · video

[Music] in order to subscribe to my channel please click here or click here please share comment and like my videos and channel hello guys welcome to sassword service now in this video you will learn about display business rule you will learn what is display business rule and how it works in service now what is display business rule display business rule is triggered when user opens a form the major use cases of display business rules are storing field value for client so if you have to populate something on client and you have to get that value from the server in that case you can use display business rule and that is also you use with g underscore scratch pad you will see it later and another major use case of business display business rule is displaying message on the form if you just want to display message on the form to the users always use display business rule display business rule without scripting so if i go to my personal developer instance now for showing you display business rule without scripting i will just show you a message so i will go to incident and i will go to list of business rules i will deactivate this one and we will create a new one and i will just mention here demo for display and here i will check this advanced and here i will select display that's it and you can see when i'm when i'm selecting display everything gone there's no operation selected you cannot select the operation anymore that's the reason behind it because this play business rule only works on the form when user opens the form that's it there's no database operation involved in display business rule so in this case what i will do here we have display so maybe i will just do like this on load of form maybe priority is p1 and i can just go to here and i can just mention the message the priority is p1 for this incident that's it displaying the message and if i click on save now i will open any existing incident who has priority as one so if i go to open i will open this one and if i will open this you will see when form will be loaded you can see the priority is p1 for this incident it is automatically showing this now this method which you can see here it is happening because of display business rule that's how you can create display business rule without a scripting display business rule with a scripting now i will show you the example of g underscore scratch pad we will try to store that value and we will show that on client that why exactly and how exactly we use display business tool with scripting so if i go to my personal developer instance and i just go to business rules i can use the same one so i will just come over here so let's say i will just keep this particular condition as it is it will be for p1 and for actions i can remove this because i have to write the script now i will go to script now in order to capture to store the value we have to use g underscore scratch pad variable how can i do that i can just do g underscore scratch scratch pad dot maybe let's say we are we are picking uh priority one and we are picking let's say we are picking shot description so i can do just do like this uh dot sd i can do equal to and then i can do current dot short description that's it that means you have stored the value of short description in this global variable we have that is g underscore scratch pad so this means that we have captured the value of current short description and current incident in this object that is g underscore scratch pad and we will have this variable dot sd so what i will do now i can just click on save that's it so for creation of g underscore scratch pad for storing the values that's how you create the variables and you are done you just need to use this value on the client how can i do that i will again go to incident now i will create a client script now i'm creating it just to show you that how you use g underscore scratch pad so i will go to client scripts and i will just click on new i will just quickly do test it will be type onload that's fine now here i can put alert now that's something you have to see i will do alert and here i can do this is a p1 4 and i can do g underscore scratchpad dot sd because i can get the value of short description so in that case do you underscore scratch pad now ideally like as of now i have used it for the for the string but most of the times if i talk about g underscores uh dns score scratch pad you have to use it for reference field so you can get the data of reference and server data and then you can use it because if i talk about client you can still access with the help of g underscore form dot get value you can still access the value of the short description but i'm just showing you the demo that how exactly you use this but moreover if you in the future if you want to use g underscore scratch pad mostly you will use it for basically reference fields where uh those data those fields are not available on the same table and that's how you use g underscore scratch pad so i will just click on save now and if i will open priority one incident and i go over here let's say i open this one you can see it says this is a p1 for sdsdd and we got that value basically from business rule we because we created that gnscore scratchpad object variable that's what we created and that's something we can use on client script so you can basically fetch any data store any data from server side and populate it on the client with the help of g underscore scratch pad and this is how you create display business rules to fulfill the requirement of your customers and client

View original source

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