mail script to get requested for from request into sysapproval_approver notification

Community Alums
Not applicable

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? 

find_real_file.png

1 ACCEPTED SOLUTION

Allen Andreas
Administrator
Administrator

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!

View solution in original post

5 REPLIES 5

Community Alums
Not applicable

I was looking in the 'Recipients' field of the email record in the system and didn't see the Requested For listed in it, but when I click Preview HTML Body, I see the two people that are in the recipient's list plus now a CC field, so yea it does work! Thank you!