- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-06-2024 05:26 AM
Hi ServiceNow Community,
I'm trying to hide "Create Security Incident" UI Action if it has been already created before from the current incident. For information the record of the Security Incident is visible in the Related list. Could you please help ?
Many Thanks
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-06-2024 05:33 AM
That should be fairly easy to do. First, check the related list to determine how the relationship is established. Then create a script include with a function that checks that relationship where the parent is the current record. make sure the SI function returns the value you expect.
Assuming that the records are on the security_incident table and are related through a parent field, the SI function might look something like:
function hasSecurityIncidents( current ){
return new global.GlideQuery.parse( 'security_incident', 'parent=' + current.getUniqueValue() ).count() > 0;
}
while the condition field on the UI Action might look something like:
!(new MyScriptInclude().hasSecurityIncidents( current ));

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-06-2024 05:33 AM
That should be fairly easy to do. First, check the related list to determine how the relationship is established. Then create a script include with a function that checks that relationship where the parent is the current record. make sure the SI function returns the value you expect.
Assuming that the records are on the security_incident table and are related through a parent field, the SI function might look something like:
function hasSecurityIncidents( current ){
return new global.GlideQuery.parse( 'security_incident', 'parent=' + current.getUniqueValue() ).count() > 0;
}
while the condition field on the UI Action might look something like:
!(new MyScriptInclude().hasSecurityIncidents( current ));