- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a week ago
I have a variable named Purchase type which has like 4 values and when i select one value which is Refinery Request, then a bunch of variables which are declared under variable set MRVS, like Quantity, Asset number. They all should be made read only and non mandatory.
I tried to use UI policy but it is not working
Please suggest.
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thursday
you can write onLoad catalog client script on MRVS and then use this logic
Note: I assume your purchase type variable is outside MRVS
function onLoad() {
var variableValue = g_service_catalog.parent.getValue("purchaseTypeVariableName");
// give correct value to compare here
if (variableValue == 'Refinery Request') {
// make your mrvs variables read only and non mandatory here
}
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a week ago
Hi @Abdul ,
In your existing UI policy add below two lines of code.
function onCondition() {
var my_var = g_form.getField("MRVS_Name");//use your variable set name here
g_form.setReadOnly('MRVS_Name',true);
}
This will make the variable set read-only and hide the edit/delete/add and remove all buttons.
For you want to do more customization refer this.
Thanks,
Bhimashankar H
-------------------------------------------------------------------------------------------------
If my response points you in the right directions, please consider marking it as 'Helpful' & 'Correct'. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thursday
you can write onLoad catalog client script on MRVS and then use this logic
Note: I assume your purchase type variable is outside MRVS
function onLoad() {
var variableValue = g_service_catalog.parent.getValue("purchaseTypeVariableName");
// give correct value to compare here
if (variableValue == 'Refinery Request') {
// make your mrvs variables read only and non mandatory here
}
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Friday
Hope you are doing good.
Did my reply answer your question?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader