In the catalog item workflow approval will goes to user selected in the variable

Servicenow de11
Tera Contributor

Hello,

 

I have a requirement that is user selected in the catalog item variable(single line text) approval will goes to the person existing in the variable.

Please help me to achieve this.

 

Thanks 

1 ACCEPTED SOLUTION

Hello @Servicenow de11 ,

 

Use this-

Harsh_Deep_0-1698391684933.png

and use this script -

var answer = getAnswer();

function getAnswer(){
var user = current.variables.YourRequiredField.toString();
var grUser = new GlideRecord('sys_user');
grUser.addQuery('name',user);
if(grUser.next()){
    return grUser.sys_id;
}
}

 

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.

View solution in original post

11 REPLIES 11

Harsh_Deep
Giga Sage
Giga Sage

Hello @Servicenow de11 

 

If it is single line text then you need to first

Lookup record where name is that single line text

 

Then ask for approval and drag and drop Lookedup record.

 

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.

Hello Harsh deep,

 

If the user selects his name then manager hr partner will autopopulate in that single line text then approval will goes to that user manager hr partner.

Hello @Servicenow de11 

 

If it is single line text then it will not send approval,

For that you need reference field.

That's why I told you to lookup record first.

 

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.

Hr partner field is the string field in the user's table. If i take variable as reference field then user's manager hr partner is not auto populating so i took variable as single line text.

Is their any other way or script in the workflow to trigger the approval to users manager hr partner