Need clear 'closed' and 'closed by' by fields

swarish
Kilo Contributor

Hello Guys,

While reopening incident from java application 'incident state' is updated to 'In Progress' but 'closed' and 'closed by' fields not getting clear.

My JSON Object is below.

{  

"active": "true",

"state" :"2",

"incident_state": "9",

"closed_by":" ",

"u_approval":" ",

"closed_at" :" "

}

API : https://******dev.service-now.com/api/now/table/incident/8346940f0f52320039e8348ce1050e13

Method Type : PUT

Please let me know, If am doing any thing wrong.

Thanks,

Rishikesh Kashid

4 REPLIES 4

brendanwilson84
Kilo Guru

A on change client script should work



On change field name "state"



function onChange(control, oldValue, newValue, isLoading, isTemplate) {


if (isLoading) {


  return;


}



if ( newValue == '''In Progress" ) {


  g_form.setValue('closed','');


  g_form.setValue('closed_by','');  


  return;


}


Hello Brendan Wilson,



I wont need script. Am using API for reopening incident.


I have integrated service-now in my java application.I want same behavior at both side.


May be i do not have access to clear fields 'closed' and 'closed by'.



Thanks,


Rishikesh


Jim Coyne
Kilo Patron

What you should do is create a new "onBefore" Business Rule that would clear the fields.   This way the logic remains in ServiceNow and a Business Rule will run whether the update was done manually by a user logged into ServiceNow or through an integration (like yours).



Here is what your Business Rule would look like:



find_real_file.png



find_real_file.png



You may have to change the conditions a bit based on your use cases.


Alikutty A
Tera Sage

Hi Rishikesh,



This is something that needs to be performed on the target table as a result of reopen and not using the web services. You should write a before business rule on incident table when state changes to In progress and set the 2 fields to empty (clear them off).



Thanks


Please Hit like, Helpful or Correct depending on the impact of the response