Send a workflow notification to the person set as the SC Task Assigned To

Marc43
Kilo Expert

I am trying to send a simple notification at the end of a workflow to the individual set as the assigned to on the catalog task, however, it does not appear to be sending out. Hoping someone can point me in the right direction. The script I currently have is:

 

// Set the variable 'answer' to a comma-separated list of user or group sys_ids that you want the email sent to.

answer = current.assigned_to;

1 ACCEPTED SOLUTION

Claudio Luciani
Giga Contributor
If you have only one task on the RITM you could try it this way, or adapt it to your needs.

Code:

var gr = new GlideRecord("sc_task");
gr.get("request_item",current.sys_id);
answer = gr.assigned_to;

find_real_file.png

View solution in original post

4 REPLIES 4

Konstantin7
Mega Guru

My guess is that the workflow runs on sc_req_item level and not on sc_task level. If you are trying to send the notification to sc_task.assigned_to, you would need to create a script to find the last updated sc_task for this Requested Item.

If the workflow is at sc_task level, then why are you making it more difficult? The notification activity allows you to select the field from the table.
find_real_file.png

Ashok Katam
Mega Guru

Hi Marc

If you have this as an activity in workflow, current.assigned_to will be empty by default as it looks for assigned_to on RITM table.

But, you said you want to send the email to the individual set as the assigned to on the catalog task, so you can create notification on sc_task table to send out after closing that particular task and send it to the Assigned To of the task.

 

Thanks

Prateek kumar
Mega Sage

Only create an event from the workflow. And from this event trigger your notifications.

Trust me, it would be so much pain when it comes to debugging or updating WF notifications.

https://docs.servicenow.com/bundle/kingston-platform-administration/page/administer/platform-events/...

https://community.servicenow.com/community?id=community_question&sys_id=9f9e0361dbdcdbc01dcaf3231f96...


Please mark my response as correct and helpful if it helped solved your question.
-Thanks

Claudio Luciani
Giga Contributor
If you have only one task on the RITM you could try it this way, or adapt it to your needs.

Code:

var gr = new GlideRecord("sc_task");
gr.get("request_item",current.sys_id);
answer = gr.assigned_to;

find_real_file.png