- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2024 02:26 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2024 02:34 AM
You want to make read only after Submit , if yes then
https://www.servicenow.com/community/itsm-forum/set-variables-readonly-on-ritm/td-p/834889
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2024 02:37 AM - edited ‎01-17-2024 02:41 AM
Hi @Basina Akash,
The best practice would be to leverage a UI Policy and set each field/variable read-only.
You also have the option to leverage the g_form.setVariablesReadOnly(true) method via an onLoad Client Script.
This method is specifically reserved for the sc_task and the sc_req_item table. (It will not work with any other table)
If you are trying to make the variable read-only on the Variable Editor, use the below script via an onLoad Client Script.
function onLoad() { $("variable_map").querySelectorAll("item").forEach(function(item){ var variable = item.getAttribute("qname"); g_form.setReadOnly("variables."+ variable, true); }); }
To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Helpful.
Thanks, Robbie
Further details and ServiceNow documentation can also be found here:
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0752560
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2024 02:31 AM
Hi Akash,
On the catalog item you are configuring, check related tabs for variables. Locate and open the variable you want to make read only. From there, check the read only checkbox.
Mark my answer helpful and solution proposed if this helped.
Thanks 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2024 02:34 AM
You want to make read only after Submit , if yes then
https://www.servicenow.com/community/itsm-forum/set-variables-readonly-on-ritm/td-p/834889
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2024 02:37 AM - edited ‎01-17-2024 02:41 AM
Hi @Basina Akash,
The best practice would be to leverage a UI Policy and set each field/variable read-only.
You also have the option to leverage the g_form.setVariablesReadOnly(true) method via an onLoad Client Script.
This method is specifically reserved for the sc_task and the sc_req_item table. (It will not work with any other table)
If you are trying to make the variable read-only on the Variable Editor, use the below script via an onLoad Client Script.
function onLoad() { $("variable_map").querySelectorAll("item").forEach(function(item){ var variable = item.getAttribute("qname"); g_form.setReadOnly("variables."+ variable, true); }); }
To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Helpful.
Thanks, Robbie
Further details and ServiceNow documentation can also be found here:
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0752560
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2024 02:38 AM
Hi @Basina Akash
You can set the variable read-only by creating catalog UI policy for your catalog item.
Create catalog UI Policy and catalog UI Policy action as shown below
Select your catalog item name of your variable that needs to be set read-only in 'Catalog item' field.
Select 'Applies on Requested Items' checkbox
Create UI Policy Action for your variable as shown above
Please mark this response as correct or helpful if it assisted you with your question.
