The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Field won't update

tgutierrez
Tera Contributor

I have a custom deal table with a bunch of records with fields that will revert back to the original value after trying to update the field. As far as I can tell records created before I created a business rule that creates a customer project and imports some of the information from the deal table are the only ones affected and will not update. Records I created to after to test the business rule will update. 

I'm still pretty new to service-now development and there are other business rules that I had nothing to do with affecting the deal table. I've spent most of today spinning my wheels trying to figure this out. If any one has any idea where I can possibly start searching for an answer, I would greatly appreciate any help provided. 

Below is the business rule mentioned above.

(function executeRule(current, previous /*null when async*/) {

	var gr = new GlideRecord("customer_project");
	gr.initialize();
	gr.setValue("short_description", current.name);
	gr.setValue("description", current.description);

	var project = gr.insert();
	current.customer_project = project;
	current.update();

})(current, previous);

 

Thanks.

1 ACCEPTED SOLUTION

check if there are any other rules running on that field.

https://docs.servicenow.com/bundle/rome-application-development/page/script/debugging/concept/c_FieldWatcher.html

View solution in original post

4 REPLIES 4

Gabor10
Mega Guru

Hey!

Business Rules will not update historic records unless the Business Rule's conditions are triggered by those old records.

In case you want to update the records in the table historically, you'll either need to somehow trigger your business rule for those records our you'll need to write a Fix Script.

 

https://docs.servicenow.com/bundle/rome-application-development/page/build/applications/concept/c_Fi...

 

 

Sorry let me elaborate. i don't need the business rule to update the field, the field gets updated manually. The problem I'm running into is that the field gets reverted back after saving and no change gets made. I only brought up the business rule because that was the most recent change I made and maybe I missed something.  

check if there are any other rules running on that field.

https://docs.servicenow.com/bundle/rome-application-development/page/script/debugging/concept/c_FieldWatcher.html

Maybe the value is only overwritten on Client Side by an onLoad() client script and the database value is still okay.

 

Can you check if the value is reverted in list view as well? Alternatively, you could  check the XML of the record to see the same.