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

Hello @Servicenow de11 

 

Glide that RITM and get the single line text variable's value, and the glide into sys_user table and glide for that variable with the name.

Then get the user_sys_id and send approval using advance method.

 

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

Can you please give me the script

 

Thanks

Hello @Servicenow de11 ,

 

Are you using Workflow or Flow

I am using workflow.

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.