logo

NJP

ServiceNow System Properties DEEP DIVE

Import · Sep 19, 2022 · video

hey everybody it's time for another servicenow toolbox my name is robert fedorick it is so good to have you here in this episode we are going to be taking a deep dive on system properties now if you've never used system properties you can think of them as facts that determine how different applications in servicenow work if you've ever added an attachment in servicenow you've already engaged with how system properties work because it's system properties that tell servicenow what the maximum file size attachment is and what file types that you're allowed to upload in the first place now you know assist property helps determine how an application behaves but there's two important things that you should also remember about system properties number one is that it frees you from the need to hard code anything into any of the scripts you write across the platform we've all been in situations where it's like and then the task goes to this group that's in a business rule so you're hard coding a society if you're ever in the feeling where you're hard coding a value and you think maybe there's an even the slightest possibility that this value might change in the future don't hard code the value into the script make a system property and then reference that system property with the script so if you're using system properties to your advantage no more hard coding values in scripts and the last thing i want you to keep in mind for sys properties is it helps you distribute administrative loan imagine you make a custom app for somebody and the process owner has a bunch of options for the app well it might work this way we might want to shut this on or off we might want to have default values here here and here well if those are going to change at any time you can take all those sys properties and you can allow people of other roles to write to them so it's not strictly a system admin thing to modify so in review the three points system properties help you determine how applications work allow you to do less hard coding in your scripts and allow you to distribute some of the administrative loan we already talked about attachments let's cover a couple other examples this is the incident management properties have you ever wondered why incidents auto close after a certain number of days in the resolve state it's because of a system property by default it's seven you can change it to whatever you want likewise you can control whether the incident tasks get closed whenever the parent incident is closed you see these are different behaviors that different customers might want a say in and so they make the switch via a system property another example you may have come across if you're an admin is email configuration properties whether or not your email send receive is on which address all of the emails go to for a given instance whether or not you're adding invisible watermarks to the email and the number of journal entries you're going to send if you add the comments or work notes to an email all governed by system properties because they are all configurations that might change in the future and you want to control how that app behaves okay let's think of some other ideas that i haven't been able to display think about default groups for assignment escalation groups owners for the application whether or not you want a certain function to work endpoints for integrations retry intervals for integrations that fail in their messaging thresholds for various measures and the number of days until something else happens okay i have this application on my pdi called things and they're just really basic tasks they track number priority state short description and i have a custom field called score and let's add some system properties so i might want to have a whole bunch of workflows for things and i always want things to be assigned to the thing processing group and i always want the escalations of things to go to the thing escalation group okay so i already have two properties in mind and i'm also going to play around with the idea of having score thresholds so i may want to have code around whether or not anything has exceeded a certain score now these are all things i'm imagining that are going to be in business rules and workflows all over the platform but let's get them into sys properties so we can reference them no matter what their values are so to do that you go to sysproperties.list this brings you to a list of all the system properties and we're going to create new here we are on a new sys property it's going to ask us for a suffix now this is because i am inside a scoped application already my things application if you're doing this in global you would just have to provide a name there's lots of thought out there about good naming conventions i personally like jase benson's naming convention of company process function uh in this case my app kind of is the process so i'm going to say now it automatically makes the name for me because it could put my application prefix ahead of this again if you're doing this in global all you have to worry about is a name now descriptions are super important in this context because later when we teach you how to make these properties available for other people to see it's the description that is going to be the label for the property i'm adding this description that this will be used to automatically assign things from flow designer choices is a comma delimited list of strings if your type is choice and this blends nicely into the different types of system properties you have everything from choice lists to colors dates images integers strings time zones true false not as wide an option as say fields but still a strong list of system property types i'm going to use string for most of this and i'm going to put a value of this this is the cis id of the assignment group that i want to be the default there's a few other properties you want to be on the lookout for there is this property ignore cash being super real with you here i'm not entirely sure the significance of this it's true by default i understand that if you change a system property that has this marked as false it will do a cache.due on the system probably pretty risky so keep it with the default unless you are of exquisite knowledge about what caching does the private property dictates whether or not value changes of the sys property get captured in update sets and migrate between instances also it will keep this value if you're cloning down so if you have various system properties that must be different depending on the instance that you're working on then you want to mark those sys properties as private the next two are also awesome they are what we talked about before where you can distribute the admin to other roles so i want the thing admins to be able to read this sys property and i want them to write this sys property because as soon as i deploy this app it's all on the thing it means it's nothing to do with me so now i have a system property called assignment group it's going to be used in the flow designer it's a string and it's a value of assist id and the things admins can read and write to it i'm going to submit that we're going to create another one and this one's going to be an escalation group so that's the value of my escalation group i'm going to call this servicenow is going to name it for me with my scope.prefix again we're ignoring cash we're not making this private we got to make the read and write to the thing admins and we're gonna find one more prop and this one is going to be score dot threshold it will be used in scripts to determine if a thing is above or below our preferred threshold the default value is going to be 50. i would love for this to be a decimal unfortunately that's not a type that's available to us in sys properties so i'm just going to leave it as a string i'm going to remember if i'm going to do math on it within a script i've got to do an appropriate conversion so we're just going to keep these simple simple 50 and strength and we got to put the read and write roles in and once that's done i'm going to submit now we've got three system properties for the things app let's imagine some scenarios where we'd want to do scripting around it now the only reason we've built properties in the first place is so that we can reference them in all of the other servicenow building blocks specifically in code we're not going to build out any business rules or script includes or workflows or anything like that we're just going to run scripts using the property lookups rather than the hard-coded values in the first scenario we're imagining i want to know what the default assignment group is for things because it could have changed 100 times since we created that property let's go check so i'm going to create a variable called prop and this variable is going to be defined as a function that's the gs.getproperty gs.getproperty takes the name of a property and returns you the value really easy so we're going to gs info out the raw value of the property and then we're going to use a function to look up the group feeding it the sys id from that property and see what happens so we're going to run this script so we're going to run this script and we see the raw value of the property is that cis id and the group name is things processing exactly what i expected so you can imagine if you're in some kind of script that's auto assigning to the default group there you go okay for the second test i want you to see here that i've got things none of them have an assignment group i would love to run a fixed script that assigns all those back to the default assignment group whatever that might be so again i've got a script up here what it's going to do is a good time to find a variable called default group default is going to be gs.getproperty the value of the property that is the default.assignment group then we're going to do a glide record looking up to the things table we're going to add a not null query on the assignment group and then we are going to set the value of the assignment group equal to a default group what's default group they'll look up to the property that we just defined then we're going to do a things.updatemultiple and we're going to see what happens run the script then i'm going to go to my things table and i'm going to refresh and we see that now all the things are assigned to the default group that we defined okay last test we define that score threshold as 50 and we know that we've got a bunch of things some are below 50 some are 50 and above and what we are going to test for is whether it's below or above the threshold so we've got a variable of threshold that is defined as the gs property that we've got defined and we are defining a variable called things it's a lookup to the things table and while things.next it's going to determine if the thing score is greater than or equal to the threshold if so it's going to gs info that the thing's number is above the threshold otherwise it's going to say it's below the threshold so let's run this script and see what happens and we see that there's two below the threshold and three that are above the threshold so again if you want to have different pathing in your logic depending on a value that somebody determines arbitrarily then sys properties are for you so now we've seen how to build them and we've seen how to utilize them let's wrap it up by distributing that admin load onto the process owner so this thing process is built for a certain person and i want that person to be able to change the properties right now what we're going to do is create what's called a system property category if you look at how email is defined you see these kind of sections incident closure properties incident reopen properties copy incident and create child incident properties that's what we are going to build then we are going to load them into this system properties underscore ui dot do so you will find sys property categories under the sys properties menu in your navigator bar in the categories link so we're gonna click that and we're gonna click new and we're gonna call this thing properties and we are going to save this and so now it's basically just a section what we need to do is populate it with properties so we've got this related list for properties we can click edit i'm going to look for my x underscore in 1946 because that's my scope name and there we go things default there we go assignment group escalation group score threshold let's move that over save it so now we've got this section just waiting to be rendered on that page so we've got to invoke that page let's do it from our modules list so i'm going to go to my things module and i'm going to edit that and we want to make a new module we're going to call this properties and we're going to block that off just for the admin and the link type this is really important is gonna be a url from arguments it's gonna look complicated but i'm gonna break it down nice and simple for everybody okay so we just think about these as three separate things it is going to call this page that already exists called system properties ui dot do okay that's the interface it's going to call and we are going to give it a title so whenever the page comes up what do we want the title to be we're just going to call it properties real simple and then we need to call a syspalm category that's going to be the set of properties that we put into that page and what did we just finish defining we just defined just finished defining a system properties category so we're going to take that category things properties and that's what we're going to do it's just going to call this url plug in all those bits and it's going to return the page nice and easy for us so we're going to submit on that so here's a true test i'm going to go impersonate a thing admin and uh the person who owns this app his name is robert loblaw his friends call him bob so let's just impersonate blah blah blah and we're gonna go to our things menu and we see a thing called properties let's click that and there's our properties list so what we're going to do is change the default assignment group so maybe we don't want it going to the things processing group maybe we've moved that all over to the service desk now so i'm going to put in the sys id of the service desk i'm going to hit save let me un-impersonate say goodbye to blah blah blah then we're going to run that script again that asked us what the default assignment group is so let's run the script and we see that the sys id is changed and it's also aiming at the service desk so blah blah blah who is not a system admin successfully changed properties that makes the app work differently okay so remember the three important things a system property changes the way an application can work it also enables us to work in scripts without hard coding values and lastly it allows us to distribute that administrative load to other people so long as we define those properties with the appropriate read and write rules hope you got some value out of this one keep your eyes peeled i'll put a link right up here i am going to go to my go with the flow series and i'm going to create a flow that capitalizes on both the getting and the setting of system properties looking forward to seeing you on that one if you're a servicenow expert looking for better opportunities but maybe your resume or linkedin profile isn't doing you justice reach out to me via linkedin or the email pictured here as i offer both career coaching and recruitment services and if you're a servicenow customer or partner you heard that right robert fedoric now does servicenow recruiting with a 1500 subscriber youtube channel and mailing list and thousands of linkedin followers let's make sure your open positions get first go with the prodigious pool of servicenow resources reach out via the emailed picture here

View original source

https://www.youtube.com/watch?v=1YA8PG348Hs