Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

Add selected user as approver

Samiksha2
Mega Sage

Hi All,
I have an requirement:

There is a variable called Approver referencing to the user table and is hidden from the catalog view.
It is visible on requested item.
Fulfiller will work on Requested item and if they add any value in the Approver variable, approver should send to that user.
I tried to do in the flow designer, but it is not working when i update the form after adding the approver variable.

Please help me,

Thanks,
Sam

1 ACCEPTED SOLUTION

Bhavya11
Mega Patron

Hi @Samiksha2 ,

 

can you try something like this

create Business rule 

Bhavya11_0-1734333547280.png

script like below

 if(current.variables.apprval_user != previous.variables.apprval_user)
    var approval_gr = new GlideRecord('sysapproval_approver');
    approval_gr.initialize();
    approval_gr.state = 'requested';
    approval_gr.approver = current.variables.apprval_user; // your variable here
    approval_gr.sysapproval = current.sys_id; //Current is record that requires approval
    approval_gr.insert();

 

 

Thanks,

BK

 


Regards
BK
LinkedIn: https://www.linkedin.com/in/bhavyashree-karanth-55032a121
YouTube: https://www.youtube.com/@NowWithBhavya

View solution in original post

2 REPLIES 2

Bhavya11
Mega Patron

Hi @Samiksha2 ,

 

can you try something like this

create Business rule 

Bhavya11_0-1734333547280.png

script like below

 if(current.variables.apprval_user != previous.variables.apprval_user)
    var approval_gr = new GlideRecord('sysapproval_approver');
    approval_gr.initialize();
    approval_gr.state = 'requested';
    approval_gr.approver = current.variables.apprval_user; // your variable here
    approval_gr.sysapproval = current.sys_id; //Current is record that requires approval
    approval_gr.insert();

 

 

Thanks,

BK

 


Regards
BK
LinkedIn: https://www.linkedin.com/in/bhavyashree-karanth-55032a121
YouTube: https://www.youtube.com/@NowWithBhavya

Thanks @Bhavya11