- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Requirement : When new record inserted to live_notification table and user is not empty one bell notification should created and route to the table record mentioned in the live_notification record.
Issue :
I have created provider notification and its related records (ie content , action and link actions to record) however it is roting to the live_notification table record instead of the expected one.
I have tried by adding the log in action script however system is skipping the action.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
Are you possibly trying to create a notification based on mentions?
You can't use the record change trigger as it will have a fixed table. What you want is an async on insert business rule on live_notification. Then you want to queue an event using the record referred on the notification record by querying it with gliderecord.
(function executeRule(current, previous /*null when async*/) {
var mentiodOnGr = new GlideRecord(current.getValue("table"));
if (mentiodOnGr.get(current.getValue("document"))) {
gs.eventQueue("mention.task", mentiodOnGr, current.getValue("user"), current.getValue("field_name"));
}
})(current, previous);Change the trigger to event and remember to remove the table unless you want it to work for a single table of course. Remember to tick that recipient (sys_user) is in the event parm1 if using above.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Thank you @lauri457 , with this approach my issue has been resolved. Just one thing I have noticed that I could not select the the live_notification fields in the content as we have not mentioned table there. I have tried using the event parameters but it is not working either.
Please let me know if you have any idea how to handle this ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
You can still use variable substitution with ${column_name} but they can only be fields from the target record. So no I don't think you can reference the user from the notification record in any easy way. If it's really important to know who it was (probably not), then you can keep the table as live_notification and create a navigation handler [sys_navigator] from live_notification to the document record.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Tested it and it works, just go back to what you had originally and create the navigation handler if you want it to work like this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Thank you for this @lauri457 !
Navigation handler is something new to me.
Do I need to make any changes in the business rule from where i am triggering the event?
or by creating this record will fix my issue ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
If you want to do this then I would just probably use the trigger record update you have in the original post and discard the business rule and the event. This way the logic will stay in one place excluding the navigation handler.
If you want to use an event and edit the business rule it would be enough to do this
(function executeRule(current, previous /*null when async*/) {
gs.eventQueue("mention.task", current, null, null);
})(current, previous);
