@dt95 

are you sure the field name u_unique_code is correct?

Otherwise the script I shared will work fine.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader