How to stop duplicates entering in MRVS based on MRVS Variables(Applies Catalog item/ServicePortal)
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
I have req to stop the duplicates entering in MRVS.
MRVS Internal name is temp_workers_for_create_accounts
I write onsubmit client script under the variable set. but not working and g_form.getValue('temp_workers_for_create_accounts') is always empty.
function onSubmit() {
debugger;
var mrvsJson = g_form.getValue('temp_workers_for_create_accounts');
var name = g_form.getValue('name');
var mrvsRows = [];
if (mrvsJson && mrvsJson.trim() !== '' && mrvsJson !== '[]') {
mrvsRows = JSON.parse(mrvsJson);
}
if (mrvsRows.length === 0) return true;
for (var i = 0; i < mrvsRows.length; i++) {
var currentSysId = (mrvsRows[i]['name'] || '').trim();
if (currentSysId== name) {
g_form.addErrorMessage('Duplicate Temp Worker detected. This Temp Worker has already been added in the MRVS.');
return false;
}
}
return true;
}
0 REPLIES 0
