Workflow Approval User should be set to the manager

Jared Wason
Tera Guru

Hi,

I am working on a workflow where the manager of the user the request is for should become the approver. In the workflow, I have added an 'Approval - User' and in the approver's section under advanced I added a line that sets the answer to the user's manager. However, when I trigger the workflow it is not sending out an approval email to the manager and is just auto approving and going to the next step in the workflow. Does anyone know what I am missing here? Thanks.

 

find_real_file.png

1 ACCEPTED SOLUTION

Brian Lancaster
Tera Sage

The code should be:

answer = [];
answer.push(current.variable.access_requested_for.manager); //you may need to add .toString() after manager.

View solution in original post

5 REPLIES 5

Brian Lancaster
Tera Sage

The code should be:

answer = [];
answer.push(current.variable.access_requested_for.manager); //you may need to add .toString() after manager.

This didn't work but led me to the right answer. I had to do a GR call to find the manager then user .push method. Thank you for your help!

var gr = new GlideRecord('sys_user');
gr.addQuery('sys_id', current.variables.access_request_for);
gr.query();
while(gr.next()){
	if(gr.manager != ''){
			answer.push(gr.manager);
	}
}

Hello - Did you try:

answer = [];
answer.push(current.variables.access_request_for.manager.sys_id);

Thanks!

you shouldn't need to do a glidrecord. You may need to add toString() to the second line.

answer.push(current.variables.access_requested_for.manager.toString());