
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-03-2021 12:52 PM
Trying to use a mail script inside the body of a notification called 'Catalog Approval Rejected' that runs off the sysapproval_approver table. In the 'Who will receive' I have Approver and 'Approver.Opened by' but I also need the Requested For, which isn't available in the 'Users/Groups in fields' picker. I've been on the other forums where someone needed this also and have tried to copy bits and pieces from the Accepted Solutions to fit my own needs, but it's still not sending the notification to the requested for. Where in this mail script am I doing something wrong, please?
Solved! Go to Solution.
- Labels:
-
Notifications

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-03-2021 01:07 PM
Hi,
You should be able to simply use something like:
var userEmail = current.document_id.request.requested_for.email;
var userName = current.document_id.request.requested_for.name;
email.addAddress("cc", userEmail, userName);
This is assuming that your notification is using the sysapproval_approver table.
Then simply use this in your email notification content:
${mail_script:name_of_mail_script}
Otherwise, if you still need to use your script or would like to, simply change your addQuery regarding the sys_id to this:
user.addQuery('sys_id', current.document_id.request.requested_for.sys_id);
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-03-2021 01:07 PM
Hi,
You should be able to simply use something like:
var userEmail = current.document_id.request.requested_for.email;
var userName = current.document_id.request.requested_for.name;
email.addAddress("cc", userEmail, userName);
This is assuming that your notification is using the sysapproval_approver table.
Then simply use this in your email notification content:
${mail_script:name_of_mail_script}
Otherwise, if you still need to use your script or would like to, simply change your addQuery regarding the sys_id to this:
user.addQuery('sys_id', current.document_id.request.requested_for.sys_id);
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-03-2021 02:32 PM
Ok so here is the mail script now
and here is the notification body - the script is called at the end (highlighted in blue)
... but when I reject a RITM, only the people listed in 'Who will receive' tab of the notification are getting an email; still not the Requested For. What else am I missing?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-03-2021 02:45 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-03-2021 03:39 PM
Hi,
The script I provided works, so it's something with the email address listed for this user that you all have blocked?
Check your system email address filters:
Something you all have set is blocking the email address from being added to send, you all are blocking that domain it seems.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!