Transform Map to update records on sys_user table - unique key violation

Steven Watts2
Tera Guru

Hi,

 

I can see this question has been asked a few times before but I can't find a solution for my issue. I've created a transform map to load the value of a newly created attribute on the sys_user table. When I run the transform map I get a unique key violation error.

 

Unique Key violation detected by database ((conn=7335) Duplicate entry '8b35677187ec211019bcec6e8bbb35c7' for key 'PRIMARY')

I've set 'Run business rules' to FALSE and set both of my onBefore scripts to inactive which has made no difference. Also confirmed that no business rules on the sys_user table is using current.update().

 

StevenWatts2_0-1674475200200.png

 

Anyone had the same issue or able to advise?

 

Steven

 

3 REPLIES 3

Pratik Malviya
Tera Guru

Hi @Steven Watts2 ,

 

Are you inserting a new record in User table ?

 If not and you would only want to update records, Then you need to add below code in transform script section.

if(action =="insert"){
    ignore = true;
}

if Yes, Then there might be uniqueness of particular field is set on user table and so while transforming a data that unique field throwing error.

 

Please mark the appropriate response as correct answer and helpful, This may help other community users to follow correct solution.
Thanks,
Pratik Malviya

Hi @Pratik Malviya  

 

Thanks for responding. No, the intent is only to update records, no inserts. I have already tried the following onBefore script, currently set to inactive for testing, and unfortunately still get the same issue.

 

(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
	
    if (action == "insert") {
        ignore = true;
	}

})(source, map, log, target);

 Steven

Hi @Steven Watts2 ,

 

I tried this on my PDI but unable to replicate.

Check below, if it works for you.

https://www.servicenow.com/community/developer-forum/unique-key-violation-detected-by-database-trans...

 

Please mark correct if it helps you.

 

 

Please mark the appropriate response as correct answer and helpful, This may help other community users to follow correct solution.
Thanks,
Pratik Malviya