#450 - How to assign import contacts to a group?
Hi!
We need to import thousands of contacts into SugarCRM. If I follow the import process, there is no reference to assigning them to a security group.
Could you please advise how one would do this for imported contacts? Choosing them afterwards is not really feasible, we're talking 35,000 contacts.
Thanks
10 years ago
Upon import the contacts will inherit automatically based on the parent (account) if you have "Inherit from Parent" checked in the SecuritySuite Settings page. If you have specific groups that you want to assign then your best options are to use the list view and search for the appropriate contacts that should be added to a group, Select All, then do a Mass Assign. Another option is to go directly to the database and run a SQL script. If you are comfortable with SQL the only table involved is the securitygroups_records table. You can view existing entries in there to see how to format that data. Let me know if you need more assistance if you go that route. I'm happy to help get you in the right direction.
-Jason
10 years ago
Hi Jason, thanks a lot for the reply. So ideally the best way is a user already in the group to import the contacts? So they then are assigned the same groups, if Inherit from Parent is checked. If so then thats sounds fine.
It is possible an Admin may import them, so this wont work. In this case I am fine with SQL, so did wonder about running as script. I am just not familiar with the ID numbering used, but a quick look online tells me I can use UUID in the insert statement instead of ID? If this is the case then thats fine.
The Select All and Mass Assign approach I would say would not work because it would be about 35,000 users each time, and from experience we'll probably get a server 500 or something trying to load the page :)
Thanks very much
10 years ago
Sorry, I should have explained further. Inherit from Parent means that it inherits from the parent record. Many times contacts will be added to accounts. In that case the account is the parent. So if an account is associated to Group A then upon import creation a contact for that account will also get Group A.
There are some complexities with the import process, but that is how I recall that working.
Yes, uuid() for the id column and now() for the datetime columns.
Good point on the server time out. You can always bump the timeout in your php.ini to avoid that. If you are good with SQL I would definitely go that route first. It'll pay off in the future as you import more data.
10 years ago
Thanks, but I still think showing 35000 users on the page will be too much to handle.
10 years ago
It wouldn't show 35,000 on the page. It'll show 20, but you can select all records beyond what is on the page. The point being that it could still take a large amount of time to update all 35k records.
Let me know how the import process goes!
10 years ago
Ahhh, that may work then. I assumed Select All would select all on the page. But yes update could take time. Thanks for your help, we shall try one/all the ways to do it!
10 years ago
Another possibility is to use Process Manager (https://www.sugaroutfitters.com/addons/process-manager-enterprise) to assign the groups automatically upon import. For example, create a hidden field on the Contacts module that contains the name of the group. Then create a workflow that checks for any newly created Contact to see if the field is set to some value. If yes then assign it to that Security Group. Here's a tutorial for how to assign a group automatically using Process Manager: https://www.sugaroutfitters.com/docs/securitysuite/process-manager-adding-groups
-Jason