Approval need to configure based on field value using workflow activity

sony8
Tera Contributor

Hi ,

 

I have below requirement, How to validate below validation....

 

there is one field on my custom table which is of numeric type.

Gross value.

based on the Gross value entered the approval should trigger to below hierachy.

Requestor gets approval request (if value of Gross value entered between = 1-100)

Requestor manager gets approval request.(if value of Gross value  entered between = 101-200)

Requestor manager->manager gets approval request.(if value of Gross value entered between = 201-300)

 

the below is the scenario.

how to configure the below validation in workflow  and get the approval request?

Anyone has idea? Please share ....

 

 

1 ACCEPTED SOLUTION

add one more else if statement,

else if(grossValue>=1000){

var userGR = new GlideRecord("sys_user");

userGR.get("title", "President");

return userGR.getUniqueValue();

}

 

Mark the response as helpful & correct if it resolves your query, so the thread can be closed.

Best Regards
Aman Kumar

View solution in original post

3 REPLIES 3

Aman Kumar S
Kilo Patron

create one approval activity and in the script you can write something as:

Just validate variable names, writing code from memory

answer = checkApproval();

function checkApproval(){

var grossValue =  current.variables.gross_value;//check your variable name

if(grossValue >= 1 && grossValue <= 100){

return current.request.requested_for;

}

else if(grossValue >=101 && grossValue <=200){

return current.request.requested_for.manager;

}

else{

return current.request.requested_for.manager,manager;

}

 

Best Regards
Aman Kumar

Hi @Aman Kumar S 

 

Thanks for the response ..

there is one scenario for the below requirement.

if gross value is above 1000 the President (user table the title of President) need to get approval request.

 

how can i fetch the president details and add the approval request.

add one more else if statement,

else if(grossValue>=1000){

var userGR = new GlideRecord("sys_user");

userGR.get("title", "President");

return userGR.getUniqueValue();

}

 

Mark the response as helpful & correct if it resolves your query, so the thread can be closed.

Best Regards
Aman Kumar