Unable to submit record due to error: "Invalid update. Match not found, reset to original"

Mayank Das
Tera Contributor

Hello all

 

I am trying to update the value of 'Life Cycle Stage' and 'Life Cycle Stage Status' on the basis of selected values in 'State' and 'Substate' on a alm_hardware form. The default value of State has been set to 'In use' as per the requirements. I created an onLoad client script to set the value of Life Cycle Stage to 'Operational' and Life Cycle Stage Status to 'In use' (again, as per the requirements).

 

But I am unable to save any record. Getting the following error on Submission: "Invalid update. Match not found, reset to original".

 

MayankDas_0-1704395674894.png

 

Following is the code snippet that I have used on alm_asset table (with 'Inherited' checbox checked):

 

function onLoad() {
   g_form.setValue('life_cycle_stage','53584655b7620010ee0d3177ee11a97f');
   g_form.setValue('life_cycle_stage_status','e4990295b7620010ee0d3177ee11a9db');
}

 

Can someone please explain where I am going wrong?

 

Thanks in advance!

10 REPLIES 10

PFB the screenshot of excel sheet:

MayankDas_0-1704478057725.png

 

I don't understand why you can't set the value of Life Cycle State and Life Cycle Stage Status when State and/or Substate change.  I can see why you wouldn't want to write a script with all of the combinations, but using the Name in the setValue command does seem to work onChange.

Maybe the approach in this article, or the previous one written by the same person, would be better?

https://www.servicenow.com/community/common-service-data-model/csdm-4-0-life-cycle-how-to-implement-...  

I think you really don't need to use any client scripts.  "Life Cycle Mapping" will help you in configuring this.  Need to map the state and Life cycle control to automatically change based on the state changes.

 

Thanks,

Narsing

I tried to convince the client to use this but they want the form to be updated in real time as the user changes the 'State' and 'Substate' which can only be done through client script. I activated the Life Cycle Mappings but they work only on form submission not on change.

Could you share your scripts than?

Cause updating the value using g_form.setValue() clearly works, as @Brad Bowman said, so perhaps there is something wrong either with the client callable Script Include or the on-change Client Script calling it and updating the lifecycle fields.