Notify requestor that attachment is attached in requested item

Samiksha2
Mega Sage

Hi All,

 

I have a requirement to send notification to Requested for and watch list with attachment when attachment is added in the Requested item.

I created a mail script(to add latest attachment in the notification) and added that in the notification when additional comments changes. I asked client to add additional noted when they added attachment. but they are not agreed with this. They didn't agree with this.

Please help in this.

 

Thanks,

Samiksha

13 REPLIES 13

@Samiksha2 

something like this in BR

(function executeRule(current, previous /*null when async*/) {

	// Add your code here
	var gr = new GlideRecord("sc_req_item");
	gr.addQuery("sys_id", current.table_sys_id);
	gr.query();
	if (gr.next()) {
		gs.eventQueue('event_name', gr, gr.request.requested_for);
	}

})(current, previous);

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

Hi @Ankur Bawiskar,

 

Why suggest creating a custom BR on sys_attachment table, when there already is an event which can and should be leveraged? (As I already posted)


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

@Peter Bodelier 

I missed the earlier part.

Yes we can use that event but since the file needs to be present in the email the Event, notification should be on RITM table

One challenge here would be that email will have all files attached on RITM and not just one which was added recently. For that we will require business rule on sys_email table which is not recommended.

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

@Ankur Bawiskar,

I can see your reasoning, that is exactly why I recommended the existing event, since additional BR's on sys_attachment are also not recommended. 🙂

Using the ootb event also gives access to the sys_id of the attachment, so there might be a possibilty to leverage that in a email script. However I would need to explore the possibilities there.


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.