Catalog items-workflow editor

shaikkhasim
Tera Contributor

Hi Team

i have created a  catalog item(Dev_Req) & i have created Requested for lable(Username)

while the item requested, it will automatically trigger to concern users manager .. i have created a approval action in work flow but it is skipped automatically and directly going to the sc_task .. will you pls guide me 

 

Regards

khasim

khasim
1 ACCEPTED SOLUTION

Kavita Bhojane2
Tera Expert

Hello,

 

To request approval from Requested for's manager; you need to do below changes in the approval activity:

 

answer = [];

var manager1 = current.variables.user_name.manager;

answer.push(manager1);

 

Please mark my answer correct if you find it helpful.

 

Thanks,

Kavita Bhojane

View solution in original post

4 REPLIES 4

Danish Bhairag2
Tera Sage
Tera Sage

Hi @shaikkhasim ,

 

Can you try changing the type of username field to reference n then try again please. I believe it should work. I am not exactly sure as to wht output does requested for type field provides.

 

Mark my answer helpful & accepted if it helps you resolve your query.

 

Thanks,

Danish

Kavita Bhojane2
Tera Expert

Hello,

 

To request approval from Requested for's manager; you need to do below changes in the approval activity:

 

answer = [];

var manager1 = current.variables.user_name.manager;

answer.push(manager1);

 

Please mark my answer correct if you find it helpful.

 

Thanks,

Kavita Bhojane

Hi Kavitha

Thanks for your suggestions, it is working 

 

Regards

khasim

khasim

Vishal Birajdar
Giga Sage

Hi @shaikkhasim 

 

In approval activity , you need to glide record on "sys_user" table to get User's manager and then push it to answer array.

 

answer=[];
var user = current.variables.user_name;

var grUser= new GlideRecord('sys_user');
grUser.addQuery('sys_id' , user);
grUser.query();
if ( grUser.next() ) {
answer.push(grUser.getValue('manager') );
}

 

Vishal Birajdar
ServiceNow Developer

I know one thing, and that is that I know nothing.
- Socrates