Some PDIs are currently unavailable, and PDI actions are paused. View the latest updates here. Read More

If attachment is added to RITM then email should trigger to the all the active sctasks "assigned to"

amita2
Tera Contributor

i want a servicenow use case built where - if attachment is added to RITM then email should trigger to the corresponding active sctask assigned to member, how can I achieve this using event, BR, notification step. In the notification how can i add the (dynamic scenario to send to assigned to ) . Any other suggestion is highly appreciated here.

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron

@amita2 

you can use flow for this with no scripting and no BR, event, notification etc

Something like this

I attached the gif as well to the comment

send email to catalog task when file added to RITM.gif

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

6 REPLIES 6

Hi Mark,

Thanks for the "hate", but I already tried the notification part via event , BR (I failed to mention it in the question)but I was stuck in the part of notification which says who will receive and there we dont have option to add script, so the sctask "assigned to" would be a dynamic person for each RITM and so I was wondering if anyone would suggest their ideas 😞.

Tanushree Maiti
Tera Patron

Hi @amita2 

 

Try this:

Note: It is sample steps- update it as per your requirement.


1. Create Event
Navigate to System Policy > Events > Event Registry.
Click New.
Event name: ritm.attachment.added
Table: Requested Item [sc_req_item]
Description: Triggered when an attachment is added to a RITM


2. Create Business Rule
Navigate to System Definition > Business Rules.
Click New.
Name: Notify SCTask Owner on RITM Attachment
Table: Requested Item [sc_req_item]
Advanced: Checked
When to run: After | Insert
Condition: current.hasAttachments()

(function executeRule(current, previous /*null when async*/) {
var scTaskGr = new GlideRecord('sc_task');
scTaskGr.addQuery('request_item', current.sys_id);
scTaskGr.addQuery('active', true);
scTaskGr.query();
while (scTaskGr.next()) {
if (!scTaskGr.assigned_to.nil()) {
gs.eventQueue('ritm.attachment.added', current, scTaskGr.assigned_to.toString(), scTaskGr.number);
}
}
})(current, previous);

 

3. Create Notification

Navigate to System Notification > Email > Notifications.
Click New.
Table: sc_task [sc_task] (since it is the active task we are targeting).
When to send: Event is fired
Event name: ritm.attachment.uploaded
Dynamic Scenario Setup (Who will receive)
Go to the Who will receive tab.
Scroll to Users/Groups in fields and select Assigned to.
Subject: New Attachment on Request: ${request_item.number}

<p>Hello ${assigned_to.name},</p>
<p>A new attachment has been uploaded to the Request Item (RITM) associated with your active task.</p>
<p><b>Attachment Name:</b> ${event.parm2}</p>
<p>Click here to view your task: <a href="${URI_REF}">${number}</a></p>

 

 

 

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti