Getting org.mozilla.javascript.NativeArray@79343f70 Error
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2024 03:53 AM
Hi Team,
Iam running fix script to get the details of manager from HR profile and set it to journey table.
While running iam getting org.mozilla.javascript.NativeArray@79343f70 as log Any suggestion?
Fix script:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2024 04:11 AM
You need to always force a sys_id to a string when pushing it to an array, or you will get an array of the same sys_id / unexpected results.
emplye.push(empData.employee.toString());
This may not matter, but it's also best to specify the join of an array rather than leave it to the default:
var user = new sn_hr_core.getHiredate().getManager(emplye.join(','));
You should also use {} with your first while statement for clarity. Just as the first sys_id example, when a field has a table that is a reference, just use the field name to get the sys_id, you don't need/want to dot-walk to the sys_id field:
var managerValue = hrProfileGR.getDisplayValue('user.manager');
I don't have this table, but is the manager field capable to receive a long text string?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2024 04:59 AM
what's your business requirement here? I could see you want to update manager on HR profile but you are setting array in string field
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2024 05:19 AM
@Brad Bowman @Ankur Bawiskar ,
I made the changes and added extra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2024 05:24 AM
are you sure manager field in your table is reference to sys_user?
if yes then it should work
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader