Notifications

42 views

Description

When a user attempts to submit a form with a non-unique value in a unique string field, the form is then unable to be submitted, even after the value is changed to a unique one. After changing the value to a unique value and submitting, you receive a message reading "Invalid update. Record has been deleted or you no longer have access to read" and record is not created. Form has to be filled out again.

Release or Environment

Any as far back as Jakarta

Cause

No cause has been identified, however this doesn't happen on all forms with unique fields, because a lot of the more utilized tables already have the workaround created by default, OOB. 

Resolution

Import attached business rule and configure it for the column and table you are having the issue on.

Example: You are getting the error on the Asset form, when populating the 'Asset Tag' field, which has been set to Unique.

Business rule script would read as follows:

validateUniqueAssetTag();

function validateUniqueAssetTag() {
var assetTag = new GlideRecord('alm_asset');
assetTag.addQuery('asset_tag', current.asset_tag);
assetTag.query();

if (assetTag.next() && assetTag.sys_id != current.sys_id) {
gs.addErrorMessage(gs.getMessage('This asset tag already exists {0}', current.asset_tag.name));
current.setAbortAction('true');
}
}

 

Article Information

Last Updated:2020-02-03 15:06:58
Published:2020-02-03
sys_script_ab0b1b5edb9acc50668051035e961970.xml