Send email notification from a Transform Map script

Dazler
Mega Sage

Hi, I have been tasked with creating an inbound action from an excel sheet.  I got this working.  My excel sheet imports and then creates the Requested Items as it should.

One of the things is that once my excel sheet imports, then in my transform map I have a gliderecord that checks the User table to make sure the user has an account within ServiceNow.  If they do not have an account, then we need the transform map to send a notification for the users on the excel sheet that we didn't find in ServiceNow.  I know that I can't use html mail script in this.

How can I achieve this?  I have reviewed several links, but none doesn't provide great instructions.

This is what I've tried.  In my tranform map, I have added the following event queue.

find_real_file.png

 

I set up an event registry and then a notification.

find_real_file.png

find_real_file.png

 

But this is not working.

Any help would be appreciated.

1 ACCEPTED SOLUTION

MrMuhammad
Giga Sage

1. Replace current with source in the gs.eventQueue method. 

gs.eventQueue('new_hires_not_found', source, source.u_hiring_manager_eamil, hiringMgr);

2. Check Event Logs to confirm whether or not the event is getting triggered or not.

3. If the event triggers then the issue is with notification.

4. Make sure "Event param 1 contains recipient" is checked on the notification.

 

Regards,
Muhammad

View solution in original post

10 REPLIES 10

Sounds good. Happy to be of help.

Stay Safe! 🙂

Regards,
Muhammad

Could you please share your complete script to let us see at what conditions the variable snUser is empty and it satisfies the if condition and how you are validating the user existence.

Alok Das
Tera Guru

Hi Dazler,

I believe you want to send the email notification to the hiring manager. If yes, please click on the "Advanced view" UI action link at the bottom of the form and check the check the checkbox highlighted below:

find_real_file.png

In subject you need to enter the source.field_for_users_name instead of event.param1.name.

Also, replace current with source in gs.eventQueue().

Kindly mark my answer as Correct and Helpful based on the impact.

Regards,

Alok

Thank you for replying back.  For the table on the notification, do I to set it for import set?

Use the source import set table.

Regards,
Muhammad