workflow script for approval of given application owner approval

suresh51
Tera Contributor

find_real_file.png

Hi guys,

pls help i need to script for  application owner approval 

1 ACCEPTED SOLUTION

Are the field names correct? can you check if the application has business owner mapped? if yes also verify if owner is active or not.

keep log and verigy the values 

gs.info("business owner: "+current.variables.application.u_business_owner.toString());
answer =[];
answer.push(current.variables.application.u_business_owner.toString());

Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

View solution in original post

15 REPLIES 15

Steven Parker
Giga Sage

If you are using workflow editor and want to set the approver to the owner of the application (assuming the owner is on the same table as the application) you can just dot walk to the owner like this:

Check the "Advanced" checkbox on the approval and add this (just change the bolded section to match your form variable name and app owner field on the table):

answer = [];

answer.push(current.variables.application.owner);

This is IF you application record on your table contains the owner.


Please mark this response as correct and/or helpful if it assisted you with your question.
Steven

not working parker thank you for respondging i am trying below scriot  also but not triggerd

var answer = [];

 

//var author = current.variable.application;
var Req = current.variables.application;
var techapr = current.variables.application.u_business_owner;
//gs.addInfoMessage(techapr);
//gs.addInfoMessage(Req);
techapr = current.variables.application.u_business_owner.getValue().split(',');
var len = techapr.length;

 

for (var i = 0; i < len; i++) {

 

if (techapr[i] == Req) {
answer = "false";

 

} else {
answer.push(techapr[i]);
}
}

 

Hi Suresh,

Could the business owner have multiple owners?

If yes, please use the below script.

 

var answer = [];

 
var Req = current.variables.request_for;

var techapr = current.variables.application.u_business_owner.toString().split(',');
var len = techapr.length;

 for (var i = 0; i < len; i++) {

 if (techapr[i] != Req)

{

answer.push(techapr[i]);


}

//Answer variable can't take true false value here.

 

} else {
answer.push(techapr[i]);
}
}

Regards,

Nayan

 

no single owner