The CreatorCon Call for Content is officially open! Get started here.

How can I change primary key? (sys_id -> another column that I make)

jimin han
Kilo Contributor

I need to map reference from a table.

For exmaple, I make a 'common code ' table that has code ( I want to set this column to PK)

 I know sys_id is primary key basically in ServiceNow system, and If I refer to another table, I save sys_id of the table in reference field of table.

However, I want to push the 'code' column instead of 'sys_id' colomn because I have to push datas from the outside.

 

2 REPLIES 2

Mohit Kaushik
Mega Sage
Mega Sage

Hi Jimin,

How are you pushing data from outside servicenow, using API or using import sets?

If its import set then you can mark the 'coalesce' to true for your 'Code' field.

 

Now in order to make it Unique may be you can set the Unique checkbox to true in the dictionary of your custom field.

 

Please mark this as correct and helpful if it resolved the query or lead you in right direction.

Thanks,
Mohit Kaushik
Community Rising Star 2022

Thanks,
Mohit Kaushik
ServiceNow MVP (2023-2025)

Arturo
Tera Contributor
You can create an index on the field you want as PK defining only unique values are taken to avoid duplicates based on the field you're interested in