Unable to submit record due to error: "Invalid update. Match not found, reset to original"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2024 11:22 AM
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".
Following is the code snippet that I have used on alm_asset table (with 'Inherited' checbox checked):
Can someone please explain where I am going wrong?
Thanks in advance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2024 11:51 AM
If you populate these fields manually on a record, then filter on them in a list view, you'll see that the value of each field is the Name, not the sys_id. It's not occuring to me at this time, how/why this is, but it is, so this script will set the fields to valid values:
function onLoad() {
g_form.setValue('life_cycle_stage','Operational');
g_form.setValue('life_cycle_stage_status','In Use');
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2024 09:07 AM
Hey Brad. Unfortunately, it only solves my problem partially.
The onLoad client script was to display the value of 'Life Cycle State' and 'Life Cycle Stage Status' fields corresponding to the default value of 'State' (which is 'In Use') and it worked perfectly.
The issue arises when I create another onChange client script to update the value of 'Life Cycle State' and 'Life Cycle Stage Status' fields for other 'State' and 'Substate' fields which is not working at all. It works only if I provide the sys IDs of the reference fields which again in turn causes the form submission to fail!
Is there any other way apart from client script that I can use to resolve this issue? Please suggest.
Thanks for the previous solution though!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2024 09:24 AM
I'm not following - onChange of which field do you want to set the value of which field(s)? Supplyling either the Name or sys_id in the setValue does not work in this case? Do you need to see the other field(s) value changed on the screen before the record is saved/updated, or can it be done to the record after the save?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2024 10:06 AM
I have been provided with an excel which contains the values of 'Life Cycle State' and 'Life Cycle Stage Status' fields corresponding to different values of 'State' and 'Substate'. Whenever the value of 'State' or 'Sub'state' fields are changed, the values of 'Life Cycle State' and 'Life Cycle Stage Status' should change too.
The default value of 'State' field when a form loads is 'In Use' for which I created an onLoad client script to update the values in 'Life Cycle State' and 'Life Cycle Stage Status' fields. But these fields should change when user change the value in 'State' and 'Substate' fields too.
Clearly, I cannot use GlideAjax and script include to tackle this and creation of onChange client script using setValue and sysID is causing form submission to fail.