Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to get user table records in customer_contact table

Shruti Chennuri
Tera Contributor

I have a requirement to get sys_user table records to customer_contact table. All the records from user table should be present in customer_contact table as well. Please help me understand how this can be achieved. 

Thank you

1 REPLY 1

Robin John
Kilo Sage

This is a strange requirement. Could you validate the use case of why this requirement has been placed? sys_user table contains both requestors and fulfillers, so I would suggest to talk to your ServiceNow admin and solution architect to validate this requirement and ensure that there is no licensing infringement by doing this.

customer_contact and sys_user are two different tables. customer_contact is extend from the sys_user table and should only contain external users. So all your customer_contact records will be available in the sys_user table. Although, vice-versa is not the case. This is to distinguish between internal and external users. It is a bad practice to give a user both internal and external roles. If an internal user is also a contact, then in that case there should be a separate customer_contact record for that user.

 

That being said and advising to proceed with caution:

These are two different tables and you can write a script to copy over the records from one table to the other. All user records have the sys class name sys_user and all the contacts have the sys class name customer_contact. If you have a lot of records then I would recommend to execute them in batches and in the after work hours to ensure that the instance is not slowed down due to processing.