RITM Variables Read Only after state has become "close complete"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2017 10:42 AM
As the title states, is there a specific way that one a request is submitted and the RITM state is changed to "Closed Complete" that all RITM variables become read only?
The reason i am asking is because we have ran into issues where the business users have been changing fields after the request has been marked as complete and complaining that the request wasn't properly performed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2017 06:54 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2017 06:56 AM
Hi Craig,
Try to include only one catalog client script for onLoad and check accordingly.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2017 07:01 AM
I have tried just using yours and then tried just using the other and neither are working, the fields are still editable. thanks for trying.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2017 06:19 AM
We used a combination of a Business Rule and a client script.
The business rule is defined as such on the task table:
(function(){
if(current.sys_class_name == 'sc_req_item' || current.sys_class_name == 'sc_task') {
g_scratchpad.variables = '';
var variables = [];
var gr = new GlideRecord('sc_item_option_mtom');
gr.addQuery('request_item', (current.sys_class_name == 'sc_req_item' ? current.sys_id : current.request_item.sys_id));
gr.addQuery('sc_item_option.item_option_new.type', '!=', 11);
gr.addQuery('sc_item_option.item_option_new.type', '!=', 12);
gr.addQuery('sc_item_option.item_option_new.type', '!=', 15);
gr.addQuery('sc_item_option.item_option_new.type', '!=', 19);
gr.addQuery('sc_item_option.item_option_new.type', '!=', 20);
gr.addQuery('sc_item_option.item_option_new.u_for_task_fulfillment', false);
gr.query();
while (gr.next()) {
variables.push(gr.sc_item_option.item_option_new.name.toString());
}
g_scratchpad.variables = variables.join();
}
})();
This gets every main type of variable (excludes labels, containers, etc...) and puts them into the scratchpad for the service catalog item and task type records.
And here's the client script on the Task table:
function onLoad() {
if(g_scratchpad.variables != '' && g_scratchpad.variables != undefined){
var vars = g_scratchpad.variables.split(',');
for(var i = 0; i < vars.length; i++){
g_form.setReadOnly('variables.' + vars[i], true);
}
}
}
Now in our example we always lock them down because we don't want fulfillers changing them after a submission;however, all you'd need to do to fit your scenario is to add a condition on that initial IF statement to only perform the actions if the state of the current RITM is 'Closed Complete'.
Hope that helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-30-2018 05:17 AM
Very useful, Thanks
Any performance issue ?