logo

NJP

Email Exports - Learn Integrations on the Now Platform

Import · Dec 01, 2021 · video

[Music] in this video we'll look at exporting data via email similar to how we can use email as a way to import data we can send email notifications from servicenow to another system that accepts and processes our email message however as mentioned in an earlier video email lacks authentication so if security is a concern exporting our data via email probably isn't a good idea now this video assumes we know the basics of sending an email notification so we're going to skip over some of the details for our example let's say we have to notify our legacy employee recognition system as employees complete a training course it's on our roadmap to get the recognition app rebuilt on servicenow but in the meantime we need to use email to tell it that a course is complete and which employees have attended so they can be recognized as completing the course on our end we're going to trigger a notification at the completion of our course that sends a list of employees pretty simple let's take a look at how to build that we'll start by going to system notification email notification email script be aware if we choose to use email as a means of exchanging data the text formatting is critical have a discussion with the other systems administrator or developer about their input requirements for example they told us to include a course id and employee name separated by a pipe character we're going to use a script that's embedded into the email notification body to gather the records of all the employees who registered and completed the specified course the name of the script should use letters numbers and underscores no spaces and the template.print method is how we output information into our email notification body notice too that there is a newline character at the end of template.print so each record is on its own line unlike gs.info or similar output statements template dot print does not automatically add a new line okay our mail script looks pretty good so let's click submit now we can create the notification by navigating to system notification email notifications we'll give the notification a name choose our table and tell it when we want to send the notification when a record is updated and the state changes to close complete who will receive it is the email address of our employee recognition system so we'll click users and put a specific email address here normally we would add a subject and a body but in this case we need to click advanced view in the related links because by default the system sends html email but our receiving system only understands plain text so we'll set the content type here we'll also omit the watermark and let's take away the default email template to remove the preferences links so that none of that is included in the body and possibly processed as incoming data and for the content we'll add a quick subject and we'll call our mail script in the body like this and then we'll save the record let's click the preview notification button to test it out looks pretty good notice too that there's a related link on the notification form to quickly navigate to the email scripts involved with this notification should we need to make any script modifications let's give this a real try with our training record we'll set the state to closed complete and save and when we navigate to the system mailbox outbox open the record and click preview email we can see our records made up of pipe separated fields ready to be sent to the other system email can be a simple way to send information to another system be sure to pay attention to the formatting of the message body to comply with the remote system's input requirements and remember email lacks authentication so be aware that our email messages could be spoofed use email integrations only if absolutely necessary

View original source

https://www.youtube.com/watch?v=fEm89zmUrxE