variables read only at requested items

bennyphipps
Giga Expert

Hi,

We have a few catalog UI Policies which make variables read-only on requested item view to prevents users from amending them after they've been submitted as this could affect audit if a group was changed or a workflow issue or other reasons.

UI Policy.PNG

It's a bit of a pain to have to create a UI Policy each time we create a product and I wondered whether there is a more simple way to make variables read-only at requested item level.   Maybe a scheduled script that creates the UI policies looping through the variables for each catalog item and associated variables or if there's another even more elegant way to do it.   A Business rule perhaps that make the fields read only or something?

Any ideas???

Kind regards,

Ben

9 REPLIES 9

sundeep6
Kilo Contributor

I prefer the method I reference here: Re: Should variables carried over to the RITM be read only?


lionelcomandini
Tera Contributor

Hi Ben,



Thanks for this question,



I would suggest to avoid any customization in order to stay aligned with the product (cost, maintenance, performance, upgrade...),



I recommend to use the SNC OOTB feature, managing access by role.



  1. Open the variable form
  2. Add "Write role" to the form/list
  3. Add "admin" role to the variable


The variable won't be editable anymore after the submission by a non-admin user.



Tips and tricks : Set it up as default value.



Configuration :


Variable Configuration.png



Result :


Variable result.png




Thanks,



Regards,


Lionel COMANDINI



ITEO

Skype : lionel.comandini.iteoconsulting


Email : lionel.comandini@iteoconsulting.com



I just tried this in Istanbul and it made the variables read only within the Service Portal.   Has anyone else noticed this?


Ankur Bawiskar
Tera Patron
Tera Patron

Hi Ben,



Have a onLoad client script and check the box Applies on Requested item


and below script



g_form.setVariablesReadOnly(true);



This will make all variables readonly on submitted RITM



Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.


Thanks


Ankur


Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

on load client script or onload catalog client script?
@Ankur Bawiskar