Add an approver with IF condition

Burhan Shah
Tera Contributor

I want to add an approver to my current workflow only if a request is submitted by a user of a specific company and the approver will be the same for all requests submitted by a user of a specific company.

Below is the screenshot for your reference:

find_real_file.png

1 ACCEPTED SOLUTION

@Burhan Shah 

So take if activity and use the logic which I given in script section and code the yes node to new approval activity.

Let me know if any queries.

Happy to help:)

 

Thanks,

Murthy

Thanks,
Murthy

View solution in original post

10 REPLIES 10

Murthy Ch
Giga Sage

Hi @Burhan Shah 

You can utilize if condition activity based on the requested for company you can add the node to the new approval activity.

Sample logic:

// This script needs to set answer to 'yes' or 'no' to indicate the state of the activity.
//
// For example,
//
answer = ifScript();

function ifScript() {
    if (current.request.requested_for.company.name == "GIVE COMPANY NAME HERE") {
        return 'yes'; //trigger for approval
    }
    return 'no'; //ignore
}

Hope it helps..

Thanks,

Murthy

Thanks,
Murthy

Sorry Murthy but Can you guide me on where do I need to add this script?

answer = ifScript();

function ifScript() {
    if (current.request.requested_for.company.name == "GIVE COMPANY NAME HERE") {
        return 'yes'; //trigger for approval
    }
    return 'no'; //ignore
}

@Burhan Shah 

As per the screenshot you attached I can see two approval activities so where exactly you want to add this condition?

After the 1st level of approval or 2nd level of approval?

Thanks,

Murthy

Thanks,
Murthy

@Murthy Chintalapudi I want to add it after 1st level of approval (IT Approval).

 

Regards,

Burhan Shah