- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2022 12:03 AM
Hi, I need a help to make variables editable only for a particular assignment group in servicenow once the RITM is submitted. Could someone please help with this ?
I tried the below display BR on sc_req_item table with the condition "Item is catalog item name" and following code :
g_scratchpad.check_group = gs.getUser().isMemberOf('PC-Monitoring-AppMigration');
Then having an onload catalog client script as follows:
if (g_scratchpad.check_group == true) {
g_form.setVariablesReadOnly(false);
}
This doesn't seem to be working. please guide !. Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2022 12:10 AM
Hi,
update as this
function onLoad(){
if (g_scratchpad.check_group.toString() == 'false') {
g_form.setVariablesReadOnly(true);
}
}
Remember there might be some other Catalog Client scripts or Catalog UI policies which are Applied on RITM
Ensure those don't run or else some variables might become readonly
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
03-08-2022 12:10 AM
Hi,
update as this
function onLoad(){
if (g_scratchpad.check_group.toString() == 'false') {
g_form.setVariablesReadOnly(true);
}
}
Remember there might be some other Catalog Client scripts or Catalog UI policies which are Applied on RITM
Ensure those don't run or else some variables might become readonly
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
03-08-2022 02:18 AM
Thank you for marking my response as helpful.
If my response helped please mark it correct and close the thread so that it benefits future readers.
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
03-08-2022 02:23 AM
Thank you Ankur. with respect to a small additional query, i am trying to set a list of array values of sys_ids from script include to a list collector variable using client script. I am getting the desired output except for the first record as i am getting it as below image
Below is my script include where based on the application name and on selection of checkbox i am fetching its application instances and setting them to a list collector variable. Could you please help ?
script include :
getApplicationInstanceNames: function() {
var names = [];
var appRecord = new GlideRecord('cmdb_ci_appl');
appRecord.addQuery('u_epr_id', this.getParameter('sysparm_config'));
appRecord.addQuery('category', 'Application Instance').addOrCondition('category', 'Database Instance').addOrCondition('category', 'Resource');
appRecord.query();
while (appRecord.next()) {
names.push(appRecord.sys_id.toString());
}
return 'sys_idIN'+names;
},
onchange client script :
var appConfigValue = g_form.getValue('epr_id');
var app_instance = new GlideAjax('PopulateRelatedApplicationInstanceDecom');
app_instance.addParam('sysparm_name', 'getApplicationInstanceNames');
app_instance.addParam('sysparm_config', appConfigValue);
app_instance.getXML(fillDetails);
function fillDetails(serverResponse) {
var answer = serverResponse.responseXML.documentElement.getAttribute("answer");
alert(answer);
g_form.setValue('application_instance',answer);
}
Instead of getting the sysidIn for the first record, i also need to get the application instance name similarly like the other two in screenshot please
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2022 02:25 AM
Would you mind marking my response as correct since I answered your original question.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader