- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-20-2020 07:54 AM
Hello,
I have a record producer that allows employees to send a follow-up email to a candidate. In this example, the employee chooses to send a custom email. When submitted, the record producer updates an existing record and triggers the event that sends the notification. I am trying to trigger the event to send this notification from the record producer script (Not client script). So far my code is not working, what am I missing?
Record Producer Script:
var prospectEmail = producer.email_address;
var prospectFirst = producer.first_name;
var grProspect = new GlideRecord("x_utsll_candidate_candidate_outreach");
grProspect.addQuery('email_address', prospectEmail);
grProspect.addQuery('first_name', prospectFirst);
grProspect.query();
if (grProspect.next()) {
grProspect.follow_up_email_log = producer.log_entry;
}
var temp = producer.custom_or_auto;
var eventParm1 = producer.email_address;
var email = producer.html_email;
if (temp == 'custom_email') {
gs.eventQueue("x_utsll_candidate.canOutCustom2", current, eventParm1); // Do i need to change 'current' to 'producer'?
grProspect.status = 'follow_up';
grProspect.update();
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-20-2020 08:20 AM
Just did a quick test with event in record producer script like below. Event got triggered, Parm1 has the mail address which could be used for the notification.
gs.eventQueue('test_event', '', '', 'test@example.com');
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP
---
LinkedIn
Community article list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-20-2020 08:11 AM
Can you move the event triggering code to an After update BR?
Vinod Kumar Kachineni
Community Rising Star 2022