logo

NJP

Checklist Pro - Custom Validation and Hide / Read-Only Functions

Import · Feb 05, 2023 · video

to create a custom hide or read-only function or a custom validation function you'll need to have the servicenow admin role go to the checklist application under admin click custom validation module link click the create implementation related link this will create a script include that you will rename to something relevant to your plan functions we'll call ours custom functions for our custom functions validation we're going to update the Val function array with however many new validation functions we will be creating in our example we will create a validation function that checks if the item assumed to be a date is less than the specified day of the month so we will create a new entry in val functions array with the name LT day of month with an alias of before day of month this is the person readable representation of our new function that someone can select and then we give this new function a description so that people know what it does next we go to CLP validate functions and update the logic to include a search for our new valve function name if it matches we put in our code that will leave the return true that is valid or false invalid for our custom hide and read-only function in that same script include we update the hor function array with however many new validation with however many new hide and rest uh read-only functions we will be creating in our example we will create two options one that checks if the person is a VIP and the other if the person is not a VIP with the hor function the function name is used within the API to identify what function to apply to the function label the person readable representation seen on the configuration form the table redirects checklist Pro with the table to allow a record search and on the hide and read only form will let you pick the record from the table your function may use next go to the CLP hide or read-only function and update the logic to include a search for our new hlr function if it matches we put in our code that will either return true or false true to hide false don't hide now go to checklist Pro all and select a checklist create a hide or read-only related list item pick which item the template record to use and select the action hide or read only next pick your custom functions is not VIP no parameter lookup used in this case now we've created a register and registered our new custom hide and read-only function in the same manner in the checklist configuration record create a new validation related list entry pick a date item we'll use the same one B1 to use and select our before day of month custom validation this function expects a parameter so provide a number that represents a day within the month that we want our date item to be before remember for validations to work you must have closed conditions set to true which we do now we are ready to test let's first go to the incident as Beau ruggery and verify that he is not a VIP he won't even be able to see B1 because of our hide and read-only function rule next let's become back who is a VIP so she will see B1 but then we'll have her enter a date that is later than the value we configured so that we can see the validation rule come to life notice that we cannot close the record because we have an invalid field let's correct the value and then close the record and there you have it

View original source

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