- 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 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-21-2023 03:55 PM
Hi @-O- , how are you?!
This code I had inserted in the RP script; this third parameter "get User DisplayName()", would not work, as the initial objective would be to send the email to the specific group.
Thanks for your support!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2023 04:27 PM
You're welcome.
If the recipient is a specific group, you don't even need the 3rd parameter, the group can be set directly in the notification.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2023 04:58 PM
Hi, can you explain your use case and business drivers, what exactly are you trying to achieve?
If you are not inserting a record then you should be aborting the submit from the record producer, so business rules will not be triggered and the current object will not exist.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2023 05:39 PM
Hi @Tony Chatfield1 , how are you?!
I cried a record producer, but when the user clicks the "submit button", a notification email would have to be sent to the Group, but it is not necessary to create a Record in the Table.
I was using "current.setAbortAction(true)", it does not generate a record in the table, but if I use this there is no way to send a Notification email.
to send a notification email, it is necessary to create an “event”, “business rule” and “notification”
Thanks