- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-10-2022 05:03 AM
Hello,
I'm trying to do an import via a transform map that uses a script to properly import data
In this code below, i'm formatting fields of the column User so that it can fit the ServiceNow standards for Reference type fields (firstName lastName).
But unfortunately i always get the error "Unique Key violation detected by database ((conn=659) Duplicate entry 'bfc6fac0972611103f0f7b771153af05' for key 'PRIMARY')".
I do realize that a lot of people already posted about this error, but i just can't find a solution for my case in the forum, thank you.
N.B : user is a reference field to the system table sys_user
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-18-2022 02:19 AM - edited ‎10-18-2022 02:20 AM
So after a lot of debugging and headache, i found where the error is coming from.
When i get the first element of the name via nonformattarr[0], somehow JS puts a space just before the beginning of the string, which messes up the whole thing and generates the error.
I just had to remove the space at the beginning of the string with String.trim().
Thank you so much for the help, really appreciate it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-13-2022 01:18 AM
Throught usr.name i'm getting the name of the user in the sys_user table after querying via the second value of nonFormattedNameArray + its first value, the query is working just fine, and it fetches the right name, which means that everything is fine, but when i try to write to target.user i get that error.
Concerning the field map, i honestly have never used it, and i didn't even mention it in my script, so i doubt it's related in any way
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-18-2022 02:19 AM - edited ‎10-18-2022 02:20 AM
So after a lot of debugging and headache, i found where the error is coming from.
When i get the first element of the name via nonformattarr[0], somehow JS puts a space just before the beginning of the string, which messes up the whole thing and generates the error.
I just had to remove the space at the beginning of the string with String.trim().
Thank you so much for the help, really appreciate it.