CHEKING FOR INACTIVE GROUP FOR MAINTANCE TABLES
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
WHEN THE END USER SELECTS ACTION TYPE AS INACTIVE THE SELECTED GROUP HAS TO CHECK IN THE 5 MAINTENANCE TABLES FOR THE GROUP AND IF SELECTED GROUP HAS STILL HAVE SOME ACTIVE RECORDS THEN IT SHOULD AN ALERT LIKE(" the user first to remove the routings")
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi @pavankumars3585 ,
We can achieve this using client script and script include. Trigger the client script when the Action Type field changes to “Inactive.” Call a Script Include or GlideAjax to check the group’s status in the 5 tables.
If you can provide me with the names of the five tables along with a script, I’ll be able to help with the exact coding.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
53m ago
script include :
checkInactiveGroup: function() {
var groupId = this.getParameter('sysparm_group_id');
gs.info('groupidis:' + groupId);
// All 5 maintenance tables with assignment group field
var tables = [ { table: 'u_rbis_maintenance', field: 'u_assigned_group' },
{ table: 'u_rbis_application_enhancement_maintain', field: 'u_assigned_group' },
{ table: 'u_ad_lgm_app_enhancement_request_maintain_data', field: 'u_support_group_name' },
{ table: 'u_corp_shared_application_support', field: 'u_routing_information' },
{ table: 'u_lgm_ihm_application_support', field: 'u_assignment_group' }
];
for (var i = 0; i < tables.length; i++) {
var gr = new GlideRecord(tables[i].table);
gr.addQuery(tables[i].field, groupId);
gr.addQuery('active', false); // inactive record
//gr.setLimit(1);
gr.query();
if (gr.hasNext()) {
gs.info('found:' + tables[i].table);
return 'true'; // Found inactive usage
}
}
return 'false';
},
client script :
var actionType = g_form.getValue('sngrp_action_type');
var groupId = g_form.getValue('sngrp_select_group');
if (actionType == 'inactive') {
var ga = new GlideAjax('ADRequestUtils');
ga.addParam('sysparm_name', 'checkInactiveGroup');
ga.addParam('sysparm_group_id', groupId);
ga.getXMLAnswer(function(answer) {
alert(groupId);
alert(answer);
if (answer === 'true') {
g_form.showFieldMsg(
'This assignment group is already inactive and exists in one of the maintenance tables.',
'error'
);}
});
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
we don't know if your form is Record Producer or Catalog Item.
Your requirement is not clear.
We didn't get what you meant by Maintenance tables etc
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
55m ago
Hi Ankur . The form is a catalog item and maintenance tables means Routing tables
