Email notification from a transform map

stevewilson
Kilo Contributor

We have an inbound email action that takes an excel attachment and runs a transform map. I have an onBefore script that is checking to make sure a few fields are in the proper format. For example, make sure the date is in a certain format and that the IP address is in a valid range. All of this is currently working. Our customer is wanting an email that contains the errors so they can fix them. So if the date is incorrect they would get an email saying something like "row 10 - invalid date format" or "row 5 - ip address is invalid".

My question is how can I send out an email and save the information that was incorrect from a transform map script? Most likely there could be multiple rows with errors from a single transform of the email attachment.

13 REPLIES 13

The events match the name that the email notification is looking for. Just to be sure I copied and pasted the event name from the event registry to every place that it will be used.



I have even created a new email notification that looks at the sysevent table with a condition to send the email if a record is inserted and the name matches the event I am creating. This is also not working.



Also I tried in another instance and I am having the same problem.




I really wish ServiceNow had some better documentation and actually updated their WIKI when they released a new version. This is seems to be out of date with zero helpful information: Events and Email Notification - ServiceNow Wiki


Hello Steve,



I have had the same issue with a similar requirement. I would advise to do this:



    1. Go to Events->Registry and create the event there in case you haven't done this already. On table select Import Set
    2. On your email notification on the table select: Import Set
    3. When you create the event, create it like this:

               


gs.eventQueue('email.installrequesterrors', import_set, userEmail, importErrors);

                   


Make sure the name of the event is the same.




I'm confident that this is going to fix your issue.




Good luck!


This didnt help with anything but thanks for the input.



I found my answer:



First I added gs.getUserID() to the eventQueue.



gs.eventQueue('email.installrequesterrors', current, gs.getUserID(), importErrors);



Last, I checked both send to event creator and Event parm 1 contains recipient.


Screen Shot 2015-03-05 at 11.27.51 AM.png



I am not sure why I needed to check both boxes. This raises some new questions.




  1. Why would send to event creator not work on its own (isnt that the point of the checkbox)?
  2. Also, why wouldnt it be sent when I was passing in an email address for parm 1, it only works with a sys_id apparently?
  3. Finally, why wouldnt my email be sent when I select my user from the Users field as the only recipient?

Hi Steve,



The "Send to event creator" means that if sender is an event creator, send the mail to the creator as well. Checking the box itself, wouldn't send the mail to the event creator.


If it is unchecked, however, and event creator is the only recipient, then the mail would not be sent.



Thanks,


Mandar