setting incident to active false

Rahul Raja Sami
Tera Guru

Hi I have created a BR on request table, where it checks whether its parent is empty or not.

if not empty then it glide incident table and check for the concerned parent incident and sets it state to request created.
upto this is fine, but I want to set the incident active to false along with its state.

var gr = new GlideRecord('incident');
	gr.addQuery('sys_id',current.parent);
	
	gr.query();
	if(gr.next()){
		gr.state = '9';
		gr.active = false;
gr.work_notes='Incident converted to request \n Kindly access Request from Related List';
		gr.update();
	}

this is changing the state but not setting the active to false.
what to do?

1 ACCEPTED SOLUTION

When I tested this and got it to work, I did the condition on the first tab..."when to run" via the GUI, not on the advanced tab. The advanced tab condition is still "current.incident_state != IncidentState.CLOSED && current.incident_state != IncidentState.CANCELED"

jMarshalatuLe_0-1684947023475.png

^^ I already deleted the custom state in my PDI before I took this screener, but I did this with a custom state of "Request created"

View solution in original post

29 REPLIES 29

Hi Rahul, I'm facing same issue here. Have you resolved this? I have tried all the resolutions above but still not working. Thanks advance and appreciate anyone's response.

hi,
The issue is solved for me, please check the solution.

I have tried this in Bg scripts but didn't work

 

var gr = new GlideRecord('incident');
    gr.addQuery('number','INC0261385');

    gr.query();
    if(gr.next()){
        gr.active = false;
        gr.update();
    }

jMarshal
Mega Sage
Mega Sage

Seems silly...but try putting "false" in quotes (gr.active = 'false';)...

didn't work