logo

NJP

#4 5 Use Cases of UI Policy | ServiceNow Practical Use Cases

Import · Aug 25, 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 sas word service now this is our another session of servicenow practical use cases in this session we will talk about five use cases of ui policy scenario 1 on incident form assigned to and assignment group field should become mandatory if user changes the state to in progress so in that case if i go to my instance here and i go to incident module which is right here and if i go to the list of incidents we have and just open any any random incident where we have maybe this one where state is new and if i open this so as of now you can see we have this assignment group here and let's say i'm just removing it and i'm clicking on save and then if i change the state to in progress and if i do that you can see i can still save it so if you will if i will save this you will see that it is not mandatory so i can still save it even assignment group and assign to are empty so in that case the requirement is they should become mandatory if the state is in progress so how can we achieve it we can just go to configure we can go to ui policy so i will show you because if if you're talking about mandatory that's something you can achieve with the help of ui policy so i will click on new here which will open the new ui policy form table is already selected so i will just mention here make a g and assignee i'm just giving short name ages assignment group mandatory uh i'm not touching order for now then i will put condition here and condition is state and state is in progress and we will just uh keep these configurations as it is for now and i'm going to save it so ui policy is created now i have to create ui policy action how exactly i can do that i can just go a little bit bottom here and here we have this ui policy actions i will click on create this new button i will select the field that is assignment group first i will select mandatory true here and i will click on submit so it will be created and then i will go a little bit bottom now there is one difference you will see here as of now we are getting this red mark why we are getting this red mark i will show you quickly but before that i will also create this ui policy action for assigned to as well because we have to make it mandatory as well so i will just make it true here and i will click on submit so that means our ui policy is ready and if i go at the bottom you can see i'm getting this red mark on both the fields on both these ui policy actions what is the reason so if i will click one of them you will see that it will show you an error at the top here it says there are multiple ui polls that means on the same field you you your system already have some different ui policies like this one make fields read only on close that is the that is the policy ui policy all of you already have now how can you resolve this you can resolve it with this statement which you can see here their run order is not predictable what you can do you will make it basically a different order so that it can run but ideally it should be at the maximum because closure will definitely come later so this one should definitely run before so in that case if i come here and maybe i just give it as i will just give thousand let's see if you will if you will see the error and if i click on save this will save the order now and if i go a little bit bottom you can see now we don't have that red mark anymore so that means your your ui policy don't have any kind of error and now you can test this ui policy how can i test this so again i will go to the list of incidents we have and maybe i will just open any random incident where we have state as new maybe this one and if i open this so you can see i don't have assignment group i don't have assigned to mandatory right now and they are empty so in that case i will make it in progress and you can see that it has become mandatory so both the fields which we mentioned in our ui policy actions they became mandatory now so this is how you can achieve scenario one kind of uh situation when you get this kind of scenario from your customers and clients scenario two on story form acceptance criteria field should become read-only if acceptance criteria is not empty and state is in work in progress that's a condition that means on story form if you you have to make this acceptance criteria field read only so if i go to my instance over here and i will just click on leave this page and i will go to stories and if i come here and if i open this story let's say so for example if if acceptance criteria has something and you are making this story as work in progress in that case your acceptance criteria criteria should become empty uh read-only that's that's a requirement but you can even after making it in progress you can still change the acceptance criteria that's a out of the box behavior but if i talk about agile perspective you might get this requirement hey make this field just read only if developer has started working on this story so in that case what i can do i can quickly go to ui policies so we will go to configure go to ui policies and i will click on new here because now this time we will create the ui policy on story form it's a different table now so i will just make it here make ui policy uh read-only uh not ui policy what i'm writing acceptance criteria maybe just i will write ac make ac read only and if i select here state is work in progress and um and i can put acceptance criteria is not empty that's a condition we have and i will click on save so this is our ui policy now i will create ui policy action so if i go at the bottom i will click here and i will select the field and that's acceptance criteria and i will make it read only and i will make it true and if i will click on submit and you will see that that this will make this field read only and if i come at the bottom you can see we are still getting that particular error let's see that what error we are getting it says there are multiple in the same order in this field there are it's not predictable okay that's fine make iac read only make acceptance criteria mandatory let's see this ui policy so if i will click this uh link it will open the same ui policy and we we have i think it is just talking about mandatory only and uh what we can do let me i think if i click on advanced view so what we can do i think the order is 100 right now so what i can do i will go back to my ua policy so i will go here and i will directly go to my ui policy configure ua policies and i will click over here i will open my ui policy and then if i just open this okay i will click on advanced because we are not able to see that order field where exactly we have to change something now what i can do maybe i will again change this order so because it was the same so maybe i will make it 200 and if i click on save let's see so i have changed the order and if i come here you can see now it is not giving any kind of error to me any kind of alert to me so in that case let me just validate this so if i come here and i just maybe click on this story and you can see we have the state work in progress and yep we can see now acceptance criteria is read only i cannot change anything right here if i will make it draft now you can see it is editable but if i will make it work in progress then i cannot edit anything in acceptance criteria field so that's what that's that's how you achieve the feature uh if if you have any kind of requirement similar to the situation which we just talked about making fields basically read only as for the conditions you have from your customer and clients scenario 3 on incident form if category is selected as database then service field should not be visible to the user so let's take a look so if i go to incident and i just uh maybe before checking that or maybe let me let me just show you that quickly because that's better so that you will be able to visualize what exactly the requirement is so if i open let's say this particular incident and here if category is database that means if cat database category is selected service field should be basically hidden i should not be able to use or should not be able to fill anything in service field so in that case i will just go to configure i will go to ui policies now and i will click on new so this is ui policy form and i will give it a name so maybe service field hidden and then i will just mention here category is database and i will click on save now and i will go here now i will create the action so policy action here i will click on new i will select the field and the field we have is it's a service field so if i go here we have the service field and i will make it basically if if category is database it should be hidden so i would make it false i don't want to make it visible so i will click on submit you can also do one thing that you can also clear the value so there's an option there's a check box even if it was filled before but you have for somehow change the category and you want to remove that value from that field that is something you can also do it directly on the client as well so in that case it is created and if i go to my incident in a new tab and i open this incident and if i select category as database you can see now that service field is hidden it is not visible on the form and user cannot fill this so that's how you achieve the requirement as part of the visibility of the fields with the help of ui policy and servicenow so you can definitely fulfill the requirement of your customer and clients if they have any kind of requirement on different conditions to make fields visible or make fields hidden scenario four affected ci related list should only be visible on incident form when configuration item field is not empty on incident form now you also have another functionality in ui policy which was not there before but they they have introduced recently and in that case you can also make related lists visible or you can make them hidden so in that case i will go to my instance and if i go here you can see we have this affected ci uh related list so the requirement of is if ci is empty then it should be hidden so in that case i will come here and i will just directly go to ui policies and i will click on new so i will create a new new ui policy but this time action will be different because that is for related list not on the form fields so in that case i will make make uh affected ci maybe hidden and i can just select here configuration item is empty and i save it which will basically create the ui policy and now i will basically create ui policy action but that is not just real policy action that's ui policy related actions which you can do related list actions and which you can do from here so this time i'm not creating anything in this particular section we are creating in related list one so i will just select the related list this will automatically show all the related lists which are basically associated with the particular form so in that case i will select affected ci and i will make it visible false and that's what max you can do for a related list maybe we can make it visible or hidden then that i will make it false and i will click on submit once it is submitted your ui policy will be created it is created and now i will just quickly close this and i will open any incident racket so if i open the list of incidents we had this one and then i will just click on right here this will open up the incident form and you can see the configuration item is empty right now will i see the related list of affected ci answer is no you can see that it is not available right here and if i fill something so let's say if i select maybe yeah let's say this one if i put that you can see affected ci is visible now but that's how you can achieve this kind of functionality when your customer is asking to hide or make a related list visible as per the condition some kind of conditions in the system on a particular record scenario five on a story form when state is cancelled then work notes should be mandatory and acceptance criteria should be hidden that means they should not be acceptance criteria on the form so in that case what we will do i will go to my story list so i will just cancel this one and i will just type here stories and so the requirement is as i as i mentioned if i'm going to cancel this story so for example from here if i'm i will cancel it uh acceptance criteria should be hidden that's that's and work notes should be mandatories as of now i can cancel this without putting work notes you can see i'm able to do that but in this case i will go to the ui policy configure ui policies and i'm going to create a new ui policy so if i click on new tables should automatically be selected and i can just mention um cancel state and then i will just select the condition maybe and i will do state is cancelled and i just click on save to save this ui policy record and this time we will use ui policy action not related list because this is not something related to related lists so i will just go here click on new so basically we have to work on two fields one is work note and if i go here i think at the bottom i have this work notes i will make it mandatory and i will click on submit if i click on submit and if i another one as well so i will click on new so this time i will create another ui policy action and that will be for different field and that is acceptance criteria which should be hidden so visible is false and i will click on submit and that's it your ui policy is created with both the actions and how you will test it you can go to the stories again and you can just open any story record and i will try to change it so as of now i can still see acceptance criteria and if i change it to cancelled you can see there's no more acceptance criteria on the form and we also have this work notes field mandatory that means user have to put work notes before we save this form so that means it will continue to be mandatory that's how you achieve this kind of requirement like the scenario we just talked about that how you can make things visible how you can make things mandatory how you can make things read only how you can make things visible the related list visible or hidden with the help of ui policy so there are total four actions which you can perform with the help of ui policy thank you and have a great day

View original source

https://www.youtube.com/watch?v=0VQV9KCQxpQ