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 @Pavankumar_1 ,

Could please check whether the syntax is correct or not.

For Run Script:

SumitMahto_0-1702538235061.png

For Notification:

SumitMahto_1-1702538306427.png

For Approval user action:

SumitMahto_2-1702538362278.png

 

Aniket Chavan
Tera Sage
Tera Sage

Hello @Sumit Mahto 

I think you need to use "toString();" for me it worked after that although I didn't used the scratchpad variable and instead of that directly I used the variable name in both approval and notification activity. you can refer the below images for your reference and let me know if you still need anything from end.

AniketChavan_0-1702557034632.pngAniketChavan_1-1702557132512.png

Mark Correct if this solves your issue and also mark 👍Helpful if you find my response worthy based on the impact.

Regards,
Aniket

Hi @Aniket Chavan ,

Still it's not working for me. I had used Select Box for the type of variable and and had provided the names of approver in the question choices. You did the same?

Though in the logs I'm getting approval name but the script is not pushing it for the approval request and even not getting the notification.

SumitMahto_0-1702563110509.pngSumitMahto_1-1702563246747.png

Hello @Sumit Mahto 

I have used the variable type as lookup select box and given the reference of Group Member table (sys_user_grmember) and then used lookup value field as "user" and then applied the reference qualifier to filter the choices for IT_TLT group only by using this script and gave the sys_id of that group.
javascript:'group=957a6c6a1bcbbd108390c910604bcbe7';

 

You can refer to the below image as well for better understanding. So after using this there will be no any need to change anything in workflow script for notification and approval.

AniketChavan_1-1702564586290.png

 

Let me know if you still have any doubts or concerns.

 

Mark Correct if this solves your issue and also mark 👍Helpful if you find my response worthy based on the impact.

Regards,
Aniket

Hi @Aniket Chavan ,

I had used group sys id in the reference qualifier but getting all the members of the group. As it is not filtering out the members for IT_TLT.

 

Also, not getting notification but yes approval request is going to the selected approver.

 

Have you used any client script for the reference or its just javascript:'group=sys_id';