Script in Workflow -to send approval request to the Approver selected from a Group can only approve

Sumit Mahto
Tera Contributor

I'm having an IT_TLT group. An approver let's say "ABC" is selected from this group and now the approval request along with an approval notification should go to this approver "ABC" only not to the whole group. I need a script for geeting this done using workflow as the selection of approver is based on it's selection in the portal by the user.

15 REPLIES 15

Hi @Sumit Mahto ,

can you share the work flow screenshots?

 

If it helps please click Accept as Solution/hit the Thumb Icon.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar

Sumit Mahto
Tera Contributor

yes

 

Hi @Sumit Mahto ,

you need to use below on run script and use that WF scratchpad variable on on notification.

workflow.scratchpad.mail=current.approval.mail // you need to get the approval mail and store it on workflow scratch pad variable.

you can use workflow.scratchpad.mail in Addressee 

Screenshot 2023-12-12 at 3.24.51 PM.png

If it helps please click Accept as Solution/hit the Thumb Icon.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar

Hi @Pavankumar_1 ,

I tried the above mentioned but it doesn't worked.

SumitMahto_0-1702398875731.pngSumitMahto_1-1702398927570.png

Was there anything wrong in the script above I used? And along with the notification I want approver request to go the selected approver.

Hi @Sumit Mahto ,

if you use exactly it wont work first you need to get the approver mail of the approver and store it on the scratchpad variable and use it on notification. 

If current workflow table and approver on same table then you directly use that as below

answer=current.approval.mail //replace with your names

 Try to add logs and check the values.

If it helps please click Accept as Solution/hit the Thumb Icon.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar