Getting Wrapped Conversion Error:The undefined value has no properties error in workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2023 02:50 AM
Hi All,
I am having a script in workflow as below
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2023 04:45 AM
This is likely triggered on the var mgmtlvl or var locationNFC lines. In prod, ensure that you have a field exactly named u_management_level (case- and space-sensitive) on the sys_user table, and that it has a value for the test case, and that you have a variable exactly named Work_location (case- and space-sensitive) and that is has a value for the test case. If the error is caused by one or both being blank, and that is a valid use case, then add a check to your script like:
if (!managerlvl.nil(())
var mgmtlvl = managerlvl.indexOf('L');
if (!location.nil())
var locationNFC = location.indexOf('NFC');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2023 05:14 AM
Hi @Brad Bowman .
Thanks for the information. But both of those fields are filled with values .Even though this error is occuring
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2023 05:46 AM
Are you able to modify the script in prod then submit a new item to troubleshoot this? You'll need to add log lines throughout the script, and maybe comment out a certain line at a time until you see what is causing the error.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2023 06:03 AM
Hi,
Check if these highlighted names are correct (especially capital N and Capital W)
Try below and tell what you get in the logs
answer = checkMngr();
function checkMngr() {
var managerlvl ='';
var location = '';
var name = current.variables.Name;
var usr = new GlideRecord('sys_user');
usr.addQuery('sys_id', name);
usr.query();
if (usr.next())
{
gs.log('This was executed');
managerlvl = usr.getDisplayValue('u_management_level').toString();
location = current.variables.Work_location.toString();
}
gs.log('mgmtlvl = '+mgmtlvl);
gs.log('location ='+location );
var mgmtlvl = managerlvl.indexOf('L');
var locationNFC = location.indexOf('NFC');
if (((mgmtlvl >= 0) && (locationNFC >= 0)) || (locationNFC < 0))
{
return 'yes';
}
return 'no';
}