- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2025 09:32 PM
Whenever an Incident's priority changes to P1, you want to notify the user and make attachments mandatory .How to achieve this?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2025 02:52 AM
Hi @priyayadav8 ,
I tried your problem in my PDI and it works for me please create OnBefore Business Rule on your Incident table, and add below script
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
gs.log("Inside BR");
if (current.priority == 1 || current.priority == "1") {
if (current.hasAttachments() != true) {
gs.log("Inside BR IF");
gs.addErrorMessage("Please add an attachment");
current.setAbortAction(true);
}
}
gs.eventQueue('Event_Name', current, current.caller_id, current.assigned_to);
})(current, previous);
You can create a event from event Registry and create a Notification, trigger that notification when event is fired, and in who will receive section check the checkbox of recipient contains parm1 &parm2. Add your subject and body accordingly.
Result
Please mark my answer correct and helpful if this works for you
Thanks and Regards,
Sarthak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2025 02:52 AM
Hi @priyayadav8 ,
I tried your problem in my PDI and it works for me please create OnBefore Business Rule on your Incident table, and add below script
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
gs.log("Inside BR");
if (current.priority == 1 || current.priority == "1") {
if (current.hasAttachments() != true) {
gs.log("Inside BR IF");
gs.addErrorMessage("Please add an attachment");
current.setAbortAction(true);
}
}
gs.eventQueue('Event_Name', current, current.caller_id, current.assigned_to);
})(current, previous);
You can create a event from event Registry and create a Notification, trigger that notification when event is fired, and in who will receive section check the checkbox of recipient contains parm1 &parm2. Add your subject and body accordingly.
Result
Please mark my answer correct and helpful if this works for you
Thanks and Regards,
Sarthak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2025 03:33 AM
Hi Sarthak,
Thanks it's working ,without event also we can achieve this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2025 03:07 AM
Hi you can create a new Notification
- Navigate to: System Notification > Email > Notifications
- Click New
- Configure:
Notification Configuration:- Name: P1 Incident - Notify User and Require Attachments- Table: Incident [incident]- Active: ✓- Send when: Update When to send tab:Conditions:- Priority changes to 1 - Critical Who will receive tab:- Users/Groups in fields: Caller What it will contain tab:Subject:Your Incident ${number} Has Been Escalated to P1 - Critical Message HTML:<p>Hello ${caller_id.name},</p> <p>Your incident <strong>${number}</strong> has been escalated to <strong>Priority 1 (Critical)</strong>.</p> <p><strong>Incident Details:</strong></p><ul> <li><strong>Short Description:</strong> ${short_description}</li> <li><strong>State:</strong> ${state}</li> <li><strong>Assigned to:</strong> ${assigned_to}</li> <li><strong>Created:</strong> ${sys_created_on}</li></ul> <p style="color: red;"><strong>IMPORTANT:</strong> Attachments are <u>mandatory</u> for P1 incidents. Please ensure you have attached all relevant files (screenshots, logs, error messages, etc.).</p> <p><a href="${mail_script:incident_link}">View Incident</a></p> <p>If you have questions, please contact the IT Service Desk.</p> <p>Thank you,<br>IT Service Desk</p>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2025 05:09 AM
Hi Priya,
We can achive this using client script as well,but /
Why Client Script is NOT a useful solution for mandatory attachments
Client Scripts run only in the browser/UI, so they work only when a user is manually updating the record from the form.
They do not run for:
- REST API updates
- Integration updates
- Flow Designer / Workflow updates
- Import Set / Transform Map updates
- Background scripts
- Other Business Rules or Scripted updates
This means if Priority becomes P1 through any non-UI method, the Client Script will never trigger, and the incident can still become P1 without any attachment, which breaks the requirement.
Business Rule = server-side → mandatory for all update paths
Before Update BR:
if (current.priority == 1 && previous.priority != 1) {
if (!current.hasAttachments()) {
gs.addErrorMessage("Attachments are mandatory when priority becomes P1.");
current.setAbortAction(true); // Stop the update
}
}