- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2023 04:13 AM
Hello All and @Ankur Bawiskar ,
Can anyone please help us on the below issue.
We opened one catalog item on portal level and "Requested for" variable is auto populated,
And when we clear the "Requested for" variable to select other users then the next minute, we're getting the below error on Top.
Error: undefined- does not have an employee number in the system. Please enter one manually.
Note: We're currently in Utah version and "Requested for" variable is in one variable set and all the used catalog items level we're getting the same error.
Thanks,
LARA
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2023 04:44 AM
your client script is missing the code not to do the validation if value is empty, may be try putting below code after first line
if(newValue == ''){
return;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2023 04:21 AM
Hi @LaraReddy ,
Can you check if there is any client script or UI policy for that field which is causing this error to appear on change please.
Mark my answer helpful & accepted if it helps you.
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2023 04:32 AM - edited 10-12-2023 04:36 AM
HI Danish,
Thanks for the response.
Yes, there is one on Change client script and It's runs on Requested for variable.
But not sure why the Error is coming after clearing the Requested for variable.
Script:
function onChange(control, oldValue, newValue, isLoading) {
var usrEmp = g_form.getReference('u_requestedFor', getEmpNum);
function getEmpNum(usrEmp) {
if (usrEmp.employee_number == undefined) {
var a = g_form.getUniqueValue();
if (a != '6d914f3e1bdef300997ebb7acd4bcbb9') {
g_form.addErrorMessage(usrEmp.name + '- does not have an employee number in the system. Please enter one manually.');
}
g_form.setValue('catItemDef_employeeNumber', '');
} else {
g_form.setValue('catItemDef_employeeNumber', usrEmp.employee_number);
g_form.setReadOnly('catItemDef_employeeNumber', true);
}
}
}
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2023 04:44 AM
your client script is missing the code not to do the validation if value is empty, may be try putting below code after first line
if(newValue == ''){
return;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2023 04:32 AM
any script is doing some validation on that variable?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader