How to add approval on incident

Yaseen2
Mega Expert

Hello,

I'm new to servicenow

How can I add to the incident the caller's manger approval as a first step of approval before proceeding with incident solution, and if that could be done without the need to a create a workflow since I'm trying to keep the standard incident fulfillment process using business rules.

Many thanks

1 ACCEPTED SOLUTION

No with only one business rule you can achieve it.

your state is being requested in the approval table not in the incident. if manager is looking into his my approval his initial state is in requested.

Write After business rule on incident table. (make inactive the previous business rule and try with this one )

for testing: impersonate manager and check his approval that is being applying or not and check the state also

 

var apprvl= new GlideRecord('sysapproval_approver');
	apprvl.initialize();
	apprvl.approver=current.caller_id.manager;
	apprvl.sysapproval=current.sys_id;
	apprvl.state='requested';
	gs.addInfoMessage('approval success!!');
	apprvl.insert();
	gs.addInfoMessage('approval success!!');
	

View solution in original post

13 REPLIES 13

Hi Ashvini ,

 

Is the below part right, and on when to run ive put 'AFTER insert'

 

if (current.approval=='rejected')
{
current.state='Canceled'
//gs.addInfoMessage("rejected")
}

Hi

 

When i rejected the incident the approval status is still not requested as the attachment 

Ashvini Kadus1
Kilo Guru

Hi yaseen,

As you are cancelling the incident then there is no need to request an approval for that. that would not the best practise. If you want to reject the incident then why would you give it to the approval. 

 

And yes, the code you have written is write but only add these lines. After business rule on insert and update. because we need to update the state of an incident.

if (current.approval=='rejected')
{

try{

gs.SetValue('state','cancelled') //check the correct database name for cancelled state of an incident. 

}catch(e)

var msg= e.getMessage();

gs.addInfoMessage(msg);
}

Hi sir,

Ive posted the question again and got the below answer on the below link many thanks for your suport

https://community.servicenow.com/community?id=community_question&sys_id=691daa84db231f808e7c2926ca96195f