Using a SQL Query to Update the Person Table in SageCRM

After a recent import into SageCRM we noticed the Person table did not reflect the same Account Manager when those people are in the same Company.  We decided to update the tables in SQL rather then rerun the import and risk overwriting any new data.  The script needed to find only those records in the Person table that were linked to the Company records with a PrimaryUserID of 12.  Here is an example of a that script.

update person
set Person.Pers_PrimaryUserId = ’12’
Where Person.Pers_CompanyId in (SELECT Person.Pers_CompanyId
FROM  Person LEFT JOIN Company ON Person.Pers_CompanyId=Company.Comp_CompanyId
Where Company.Comp_PrimaryUserId = ’12’)

The same type of update can be used for SalesLogix but in SalesLogix you will need to run this script in the Admin to allow it to sync to remotes.  And always backup your db and test your script before running on your production database.  Good Luck!


1 Comment

  1. Good stuff!


Submit a Comment

Your email address will not be published.

Subscribe To Our Newsletter

Join our mailing list to receive the latest Infor CRM (Saleslogix) and Creatio (bpm'online) news and product updates!

You have Successfully Subscribed!