- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2023 05:34 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2023 05:56 AM
Use Below code in before insert rule for change request
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2023 08:36 AM - edited 08-01-2023 08:45 AM
Hi @Ankur Bawiskar , Implemented same script. i have attached 6 documents still getting error.
var rec = new GlideRecord('sys_attachment');
rec.addEncodedQuery("table_sys_id", current.getUniqueValue());
rec.query();
var count = rec.getRowCount();
if(current.category == 'CSOC' && current.u_sub_category == 'Create, Modify or Delete Rules or Playbook - CSOC' || current.u_sub_category == 'Onboard New Data or Log Source Type - CSOC' || current.u_sub_category == 'Create, Update or Delete Event Filtering - CSOC' || current.u_sub_category == 'Sentinel Administration or Change Configuration - CSOC' || current.u_sub_category == 'Install, Update or Uninstall Content Hub - CSOC' && count <1 ){
gs.addErrorMessage('There is no attachment, Please attach Email attachment from Team Manager and respective Team Head');
current.setAbortAction(true);
}
else if(current.category == 'Network' || current.category == 'Network Security' || current.category == 'Systems' || current.category == 'Systems Security' || current.category == 'Cloud' && current.u_sub_category == 'CL - Grant, Modify, Revoke Access - Custom' || current.u_sub_category == 'CL - Grant, Modify, Revoke Access - Standard' || current.u_sub_category == 'Grant, Modify, Revoke Access - Standard' || current.u_sub_category == 'Grant, Modify, Revoke Access - Custom' && count < 5){
gs.addErrorMessage('Please attach this attachments 1.Managers Approval email attached'+ " "+ "2. BGV details attached"+ " "+ "3.SF training completion attached"+ " "+ "4.Policy acceptance attached"+" "+ "5.Matrix manager approval");
current.setAbortAction(true);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2023 08:55 AM
I believe I have shared script which should work fine. Also mentioned that you need to check the field name and choice values during comparison.
The further analysis and debugging can be handled by you.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader