How to get record sys id in email script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2022 05:49 PM
Hello experts!
I can't get record sys id to be embedded in the approval notification using email script.
Scenario:
1. I have a requirement to send approval from sn_grc_metric_definition table. I created workflow for this to trigger the approval and notification.
2. Since the table is not a task table, I'd tweaked the Approval Events (Non-Task) business rules to change the 'sn_grc_metric_definition.approval.inserted' to 'sn_grc_metric.approval.inserted' event. Reason being is the system can't get the table name correctly because I guess 'sn_grc_metric_definition' is a level lower than 'sn_grc_metric_base_definition'.
3. The approval notification has finally kicked out. Approval notification is based on 'Approval [sysapproval_approver] table
4. The problem is I can't get the record sys id from 'sn_grc_metric_definition' to be embedded in the notification.
5. Tried scratchpad in the workflow but I get '..cannot read property "workflow" from undefined..' error in the log.
How to get the sysid from 'sn_grc_metric_definition' so I can generate the link to view the record in the approval notification?
Advanced thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2022 07:33 PM
Hi, unfortunately your post does not make your configuration, or issue clear.
In a notification mail script the triggering records sys_id should be available via current.sys_id and if this is not providing expected results then you will need to first check and confirm that the notification is being triggered correctly. Have you confirmed the table the notification is triggered on is correct and that you can use standard email variables to print the records sys_id into an email message body IE ${sys_id}
Normal practice for approvals is to trigger notifications from sysapproval_approver table, where the triggering records sys_id should be in the document_id field and\or the sysapproval field, using the content of these fields and the 'source_table' field you should have all you need if you cannot dot.walk values and need to use an email script\glidequery.
Also I would restore the OOB Business rule for sn_grc_metric_definition.approval.inserted,
if this BR and resulting sysevent do not deliver your requirements then the best practice solution would be to create your own sysevent, this way you can be sure that you will not impact any current or future OOB functionality.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2022 09:34 AM
Thanks, Tony! Looks like I have to utilize the Notification Message HTML itself and can't leverage the email script to achieve this.