Flow Designer | Scripted Approval is not working

IAmIshan
Tera Guru

I have one catalog item and it has only two fields:

1.Requested for 

2.Select Group

 

Once request is submitted, it will trigger approval to selected group's manager. and for this I have written script (I know we can use get variables action and we can do it without writing script for it) in Rules field, and it is working fine

 

var appr = fd_data.trigger.request_item.variables.select_group.manager;
return "ApprovesAnyU["+appr+"]";

It is triggering approval to approver but immediately updating request as Rejected.. ideally it should be requested/pending.. but thats not happening.
 
Ishan1_0-1701253681993.png

 

 

1 ACCEPTED SOLUTION

@Shamma Negi - Thanks for your response!
Actually, there was an issue with the script. I replaced it with the below script in Rules it started working fine.

 

var appr = fd_data.trigger.request_item.variables.select_group.manager;

gs.log('Group Manager SysID: '+appr);

gs.log('Group Manager Display Name: '+appr.getDisplayValue());

 

return 'ApprovesAnyU[' + appr + ']OrRejectsAnyU[' + appr + ']';

 

View solution in original post

2 REPLIES 2

Shamma Negi
Kilo Sage
Kilo Sage

Check there is one Business Rule or any other script which does this if the condiiton is met.

Please check the business rule in your instance.

 

Regards,

Shamma

Regards,Shamma Negi

@Shamma Negi - Thanks for your response!
Actually, there was an issue with the script. I replaced it with the below script in Rules it started working fine.

 

var appr = fd_data.trigger.request_item.variables.select_group.manager;

gs.log('Group Manager SysID: '+appr);

gs.log('Group Manager Display Name: '+appr.getDisplayValue());

 

return 'ApprovesAnyU[' + appr + ']OrRejectsAnyU[' + appr + ']';