Button to lock variables on RITM form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2024 03:49 AM
Hi All,
We have made all the variables of a specific catalog item editable on RITM form.
Is there a way to lock all the variables through a button or any link ?
Please assist.
Thanks & Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2024 04:35 AM
@Joshuu In OOB, we already have client scripts in "False" state on RITM and Catalog Task table. On activation, this will reflect for all catalog items.
If you want to set it for a particular catalog item then you can modify accordingly by dot walk to that item and use the syntax.
Please mark this as helpful and accept it as a solution if this resolves your query.
Thanks,
Sujatha V.M.
Sujatha V.M.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2024 04:42 AM
Hi @Sujatha V M ,
Thanks for your response. Actually below is the requirement.
1. Once the request form is submitted have all variables unlocked and editable on RITM form.
2. Ability to manually lock down all the variables via a button.
So, I have created a UI policy to make all the variables editable on RITM form and the first point is working fine. Also, I have created a UI action button as "Lock Variables" on RITM form to lock variables manually. But that is not working properly.
below is the script I have used in the UI action script on RITM table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2024 05:19 AM
@Joshuu : Please refer the below link for similar way to extract the variables,
You can push the variables and then set it to "False" using the loop defined.
Please mark this as helpful and accept it as a solution if this resolves your query.
Thanks,
Sujatha V.M.
Sujatha V.M.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2024 05:58 AM
Hi @Sujatha V M ,
I have added the code as below, but not working. could you please help me here.
var ritmGr = new GlideRecord('sc_req_item');
ritmGr.addQuery('cat_item', '4ad307bf87a455d0de4d7597cebb3539');
ritmGr.query();
//For Testing comment WHILE loop and uncomment IF loop
// while(ritmGr.next()) {
if(ritmGr.next()) {
gs.print(ritmGr.number + ': ' + getVariableResponse(ritmGr));
}
function getVariableResponse(ritmGr) {
var list = [];
var scOptionGr = new GlideRecord('sc_item_option_mtom');
scOptionGr.addEncodedQuery('request_item=' + ritmGr.sys_id);
scOptionGr.query();
while(scOptionGr.next()) {
list.push('Question: ' + scOptionGr.sc_item_option.item_option_new.getDisplayValue() + '\tQuestion Sys ID: ' + scOptionGr.sc_item_option.item_option_new + '\tValue: ' + scOptionGr.sc_item_option.value);
scOptionGr.makeReadonly(true);
}
return list;
}
action.setRedirectURL(current);