Set approval based on variable in catalog task

Madhura5
Tera Contributor

Hi All,

We have a requirement to trigger an approval based on the value that is set for a catalog task variable. This field is not visible on the catalog form or the RITM but it is only visible on the catalog task.

When the task is assigned to a particular assignment group/user and if they set the 'Request Status' field to Approval for Production then an approval needs to be triggered to a specific user. All the fields on the task should be readonly until response is received from the approver.

For any other values in the Request status field approval should not be triggered and fields should be editable on the task.

find_real_file.png

Is it possible to trigger the approval in such a way?

4 REPLIES 4

manjusha
Kilo Guru

hi,

yes you can trigger approval on specific choice of request status.

you can achieve this using workflow using approval activity and also you have to create ui policy to make all fields read only when request status is approval for production.

use workflow if you want to do something more like after approval you want to do like notify user and creation of new task.

or you can create business rule also to create record on approval table using before business rule

here in the script you have to specify whome you want to send approval

var gr= new GlideRecord('sysapproval_approver');

gr.initialise();

gr.setValue('approver','approver name');

gr.insert();

Thanks,

Manjusha Bangale

Pratiksha Kalam
Kilo Sage

Hello,

Have look on this,

https://community.servicenow.com/community?id=community_question&sys_id=1ccd0b6ddb9cdbc01dcaf3231f96...

 

If answer is helpful please mark correct and helpful!

 

Thanks,

Pratiksha

Hi all, 

I have a similar requirement where in the approval should go to a variable manager ( variable name - instead of going to the requester opener manager.

 

example A opened the request for B and B"s manager is C
So approval request should go to C/

 

I know that I have to write a script in user activity advance section but not sure what it is .

I tried below 2  but did not work 

=answer = [];


=answer.push(current.variables.requested_forPoweshell.sys_id);

=======

answer='';

if(curent.variables.requested_forPoweshell)
{

answer=current.variables.requested_for.manager.toString();

}

 

find_real_file.png

 

find_real_file.png

Ritu2
Tera Contributor

Hi all, 

I have a similar requirement where in the approval should go to a variable manager ( variable name - instead of going to the requester opener manager.

 

example A opened the request for B and B"s manager is C
So approval request should go to C/

 

I know that I have to write a script in user activity advance section but not sure what it is .

I tried below 2  but did not work 

=answer = [];


=answer.push(current.variables.requested_forPoweshell.sys_id);

=======

answer='';

if(curent.variables.requested_forPoweshell)
{

answer=current.variables.requested_for.manager.toString();

}

 

find_real_file.png

 

find_real_file.png