Please Check My Code , this code not working for me

1dusjhyahnt
Tera Contributor

Hello All 

 

Backgrouund Script :- 

 

var gr = new GlideRecord('incident');

gr.get('00cddb02479ff95068c90a79116d4312'); //SYSID OF THE RECORD.

gr.business_service ='WARE'; //for business service 
gr.setWorkflow(false);

gr.update();

 

Error :- 

BUSINESS RULE - About to execute business rule 'incident query' on incident:<span class = "session-log-bold-text"> </span>
BUSINESS RULE - Finished executing business rule 'incident query' on incident:<span class = "session-log-bold-text"> </span>
BUSINESS RULE - About to execute business rule 'Track interaction for incident' on incident:<span class = "session-log-bold-text"> </span>
BUSINESS RULE - Skipping execution of Track interaction for incident on incident:<span class = "session-log-bold-text"> </span>; condition not satisfied: Condition: !!global.RP

 

Business Service is read only field but this script not working for me , anyone check this ?Thanks in Advance 

1 ACCEPTED SOLUTION

Anurag Tripathi
Mega Patron
Mega Patron

Try this

var gr = new GlideRecord('incident');
gr.get('00cddb02479ff95068c90a79116d4312'); //SYSID OF THE RECORD.
gr.setDisplayValue('business_service' , 'WARE'); //for business service 
gr.setWorkflow(false);
gr.update();
-Anurag

View solution in original post

4 REPLIES 4

Bert_c1
Kilo Patron

The 'business_service' field on task is not read-only OOB. So change that.  Also, it is a reference field to the 'cmdb_ci_service' table, so you need to populate that field with the sys_id of the desired record in that table.

 

 

Anurag Tripathi
Mega Patron
Mega Patron

Try this

var gr = new GlideRecord('incident');
gr.get('00cddb02479ff95068c90a79116d4312'); //SYSID OF THE RECORD.
gr.setDisplayValue('business_service' , 'WARE'); //for business service 
gr.setWorkflow(false);
gr.update();
-Anurag

Prathamesh G
Kilo Sage
Kilo Sage

Hello @1dusjhyahnt ,

 

Please try with the below code as your business_service may be a reference field.

 

var gr = new GlideRecord('incident');
gr.addQuery('00cddb02479ff95068c90a79116d4312'); //SYSID OF THE RECORD.
gr.query();
if(gr.next()){
gr.business_service.setDisplayValue('WARE'); //for business service 
gr.setWorkflow(false);
gr.update();
}

 

If the above solution resolve your issue, Please mark the solution as 'Accepted Solution' and also mark it as 'Helpful'.

 

Thank You!

Prathamesh

Hello @1dusjhyahnt ,

 

Have you try with the above code? If the above code resolve your issue, 

Please mark the solution as 'Accepted Solution' and also mark it as 'Helpful'.

 

Thank You!

Prathamesh