- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2023 05:15 PM
Hi everyone,
I created a Record Producer, linked the Incident Table, but when the user submits it is not to create a record in the table, just send a Notification Email to the Group email, only this.
Business Rule Advanced:
(function executeRule(current, previous /*null when async*/) {
gs.eventQueue('send.message.notitication',current,gs.getUserDisplayName());
})(current, previous);
I had to create an event as I don't need to insert, delete or update any records on the table, because of this I'm using the event: gs.eventQueue()
There are attached print.
Could anyone support me, please?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2023 06:49 PM
Hi, can you explain the logic behind using a record producer to send an email but nor creating a record from the producer?
You should be able to trigger a sysevent directly from your record producer script and do not need to use a business rule.
eventQueue() requires a glideobject but it does not have to be 'current' and you do not have to utilize it in the notification processing, but I believe that the object will decide the table that your notification needs to be triggered from and any email variables used in the message would be mapped to this record, so recipients and content will need to be derived from parms 1 & 2.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2023 09:17 PM
Another question would be: have you tried moving the code into the Producer script? In it you can use variable cat_item readily available:
gs.eventQueue('sendEmailToDepartment', cat_item, gs.getUserDisplayName());
Assuming the 3rd parameter, parm1 will be the recipient, you should return the user's sys_id or e-mail. I don't think the user's name will be transformed into an e-mail address - this could also be a reason why the notification is not created: there are no recipients.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2023 06:49 PM
Hi, can you explain the logic behind using a record producer to send an email but nor creating a record from the producer?
You should be able to trigger a sysevent directly from your record producer script and do not need to use a business rule.
eventQueue() requires a glideobject but it does not have to be 'current' and you do not have to utilize it in the notification processing, but I believe that the object will decide the table that your notification needs to be triggered from and any email variables used in the message would be mapped to this record, so recipients and content will need to be derived from parms 1 & 2.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2023 03:42 PM
Hi @Tony Chatfield1 , how are you?!
I thought about your answer, if I use an RP I will automatically have to use Business Rules so that a notification email is triggered by an "event". I believe that the most correct way is to use the RP, have it create the record in the table and then send the e-mail to the specific group. In that case, use the standard way.
Thanks for your support!