Use If condition if requestor is requesting for others, approval go to requestor for in workflow

Community Alums
Not applicable

Hi all,

I have a requirement to use if condition in workflow, when requestor is raising requests for others, then approval should go to requestor for.

I tried using OOB conditions like "Requestor For" is different from "submitted by" but this condition did not work. Is there any way to achieve this requirement please?

 

Thanks,

Saran.

 

 

3 REPLIES 3

Brad Bowman
Kilo Patron
Kilo Patron

If you are referring to the (legacy) workflow accessed via workflow editor, as opposed to flow designer, you can do this in the Approval - User activity itself.  Leave the Approvers section empty, check the Advanced box, then your script would look something like this:

answer = [];
if (current.request.requested_for != current.opened_by) {
    answer.push(current.request.requested_for.toString());
} else {
    answer.push(current.request.requested_for.manager.toString());
}

This is grabbing the Requested for from the REQ record.  If you are otherwise taking steps to populate the Requested for on the RITM record, use

current.requested_for.toString()

instead, or if this is only in a Catalog Item variable, use

current.variables.requested_for.toString()

instead - where requested_for is the name of the variable.  You didn't specify who the approval should go to if Requested for and Opened by are the same person, so I just guessed at the Manager of the Requested for.

 

Community Alums
Not applicable

 

Hi  

I have two another requirement for approval activity.

  1. Requirement-

 Manual entry approval should be added before a group approval activity and this manual entry should be added by a manager's group.

The sequence of workflow is:

Line approval--> manual entry approver--> wait for condition--> Group approval activity--->Req in progress.

Could you please help me out with the script to add manual entry approver by a group (group managers) then group approval activity should be triggered but wait for condition should work till manual entry approval is added.

 

  1. Requirement- 

Approval Sequence:

Group owner approval (This owner should be the approver, auto populated from a form ‘Variable type is Single line Text’) -->Then Manual entry of approval (if group owner is empty, auto populated from form) ---> Wait for condition (until manual entry of approval is added by a group) ---> Group approval activity.

 

Could you please help me out with the script to add group owner approval (populated from the form 'Variable name is adm_group_owner and type is Single line Text '), if group owner is empty populated from the form, then Secret Server team to manually add the Group owner approval before secret server approvers. If no pending approvals, then REQ moves to in progress.

 

Note: Group owner approval Variable name is adm_group_owner and type is Single line Text.

 

Please help me out with the script to capture the sys id of the user populated in the form then add the same user in the approver list.

 

Thanks,

Saran.

 

 

 

 

 

Community Alums
Not applicable

Hi @Brad Bowman  

I have used the below if condition and it worked. Thanks for your help!

Thanks,

Saran.

saran20_0-1705056116846.png