Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Need help with SC Task email notifications

Joe Taylor
Giga Guru

I am trying to update the email notification "Email assigned to group (sc_task).

All fields are populated except for the "employee_name" which I'm trying to pull from the variables on the SCTASK itself.

 

This is what the body looks like:

     ${mail_script:sctask_subject_line}

     Number: ${number}

     Short description: ${sc_task.short_description}

     Request Requested for: ${request.requested_for}

     Employee Name: ${sc_task.variables.employee_name}

     Assignment group: ${assignment_group}

 

Also, my subject line script isn't pulling any values at all.

This what the subject line looks like right now:  Task undefined - undefined for undefined

This what I have for the script:  

     email.setSubject('Task '+current.sc_task.number.getDisplayValue()+' - '+   current.sc_task_short_description.getDisplayValue()+' for '+current.sc_task.variables.employee_name.getDisplayValue());

 

 

WHAT AM I DOING WRONG?

1 ACCEPTED SOLUTION

Ashutosh Munot1
Kilo Patron
Kilo Patron

HI,

 

Employee Name: ${sc_task.variables.employee_name}


variable is on RITM table. So try using this Employee Name: ${sc_task.request_item.variables.employee_name}


Thakns,
Ashutosh

View solution in original post

7 REPLIES 7

Joe Taylor
Giga Guru

Thanks Ashutosh and Jaspal.

 

This is working just the way I want now.

 

I have a follow-on question though:

I have two different Catalog Items:

Say "Item1" and "Item2".

I want to trigger different sc_task notifications for each one of these.

Right now the Event trigger for all sc tasks is: "notification_engine.process".

If I create a new event, I can't seem to figure out how to trigger it on a per-item basis.

 

Joe

 

Great to know it works.

For our per-item basis you can do below

1. You can create duplicate of existing notificaion that uses event.

2. Make it work on insert/update when Item is Item 1 && Item is not Item 2 from the filter instead of event.

3. Another one that runs on insert/update when Item is not Item 1 && Item is Item 2 from filter instead of event.

HI,

notification_engine.process" this is OOB process engine notification.

You can use notification condition builder to send notification for one item and then other notification for other item.

find_real_file.png

Thanks,
Ashutosh