- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2019 02:56 AM
Hello Friends,
I’m facing error messages when we are reading and printing all array values from for loop.
I have stored true/false fields into array.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2019 03:07 AM
Hi Basant,
this happens when you are trying to access something which has not that property
try below and check whether error comes or not
gs.info('Following Array Values : ' + gciscdP[checkboxes[i]]);
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2019 03:03 AM
Hello there,
try something like
gciscpD['checkboxes[i]']
or gciscdP[newVar], where newVar is taking the checkboxes[i] value into the loop.
for(i in checkboxes){
newVar = checkboxes[i];
gciscpD[newVar];
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2019 03:07 AM
Hi Basant,
this happens when you are trying to access something which has not that property
try below and check whether error comes or not
gs.info('Following Array Values : ' + gciscdP[checkboxes[i]]);
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2019 01:21 AM
Hi Ankur,
Thanks for your valuable response, your solution always works for me.
thanks for your support and Help.
Thanks,
Basant
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2020 11:23 AM
I am also getting the same error
Evaluator: org.mozilla.javascript.EcmaError: Cannot read property "0" from undefined Caused by error in script at line 12 9: var nm = gr1.name; 10: var len1=[]; 11: len1 = nm.split(' '); ==> 12: var cc = len1[0]; 13: var cod = new GlideRecord('u_country_code'); 14: cod.addQuery('u_code',cc); 15: cod.query();
can you please what is wrong here?