How to add multiple users to a single account in customer_contact table

mania
Tera Contributor

Hi,

 

How to add multiple users to a single account in customer_contact table.

Can anyone please help on this, It will be usefull.

 

Thanks!

3 REPLIES 3

ShubhamGarg
Kilo Sage

Hello @mania ,

 

There is one field 'Account' in customer_contact table. You can link the account to contact.

E.g. 2 customer contacts are to be linked to a single account. Then create 2 customer contact record and update account in those records.

 

However, in CSM terms one customer contact can be part of multiple account. In that case, you have to create record in contact account relationship table.

 

Let me know if it helps.

 

Regards,

Shubham

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @mania 

 

Go to Account Table, and in related list you can add

 

AGLearnNGrow_0-1723123081252.png

 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Rajesh Chopade1
Mega Sage

hi @mania 

you can approach it in different ways depending on your requirements and the specific setup of your environment.

1) Using list edit

2) Using import set

3) Using scripted approach:

If you prefer automation or have complex logic, you can use a script to add multiple users.

Example Script

Here’s a script example that you can run in the Script Background or as part of a scheduled job:

 

var accountSysId = 'account_sys_id_here';  // Replace with the Sys ID of the account
var userSysIds = ['user_sys_id_1', 'user_sys_id_2', 'user_sys_id_3'];  // Replace with the Sys IDs of the users

for (var i = 0; i < userSysIds.length; i++) {
    var userSysId = userSysIds[i];
    var contact = new GlideRecord('customer_contact');
    contact.initialize();
    contact.setValue('account', accountSysId);
    contact.setValue('user', userSysId);
    contact.insert();
}

 

I hope my answer helps you to resolve your issue, if yes mark my answer helpful and correct.

THANK YOU

rajesh chopade.