Generate Saleslogix Next Record Id via SQL

By | June 8, 2011

Very often we come across a requirement where we need to import data from an external system into Saleslogix. The quickest way to do this is to map the fields between 2 tables and import the data using SQL import or write a stored procedure or SQL cursor. All these methods would read the records from the external table and import it in SLX table. But how do we get the next primary id for the entity that is being imported. Unfortunately SLX does not provide any stored procedure that can be accessed from database level. Hence we have to create one. Here is how we can do it. This one will work only on SQL 2005 and above.

  1. We will have to create a dll which will be used in SQL as assembly.
  2. The function coded in the dll would have this code
    OleDbCommand cmd = new OleDbCommand(string.Format(“slx_dbids(‘{0}’, {1})”, “ACCOUNT”, 1), );
  3. Here the key thing is to have the SLXOLEDB.1 in your connection string and have the stored procedure executed using the OleDBCommand because “slx_dbids” function works only with SLXOLEDB.1.
  4. Before compile the project make sure you have check the “Allow unsafe code” checkbox =”True” from .NET project properties.
  5. Next step that you need to do call the function that you created in step 2 in the stored procedure or cursor every time you are adding a new record.

About Us
Greytrix a globally recognized Premier Sage Gold Development Partner is a one stop solution provider for Sage ERP and Sage CRM needs. Being recognized and rewarded for multi-man years of experience, we bring complete end-to-end assistance for your technical consultations, product customizations, data migration, system integrations, third party add-on development and implementation expertise.

Greytrix has some unique integration solutions for Sage CRM with Sage ERPs (Sage Enterprise Management (Sage X3), Sage Intacct, Sage 100Sage 500 and Sage 300).We also offer best-in-class Sage ERP and Sage CRM customization and development services to Business Partners, End Users and Sage PSG worldwide. Greytrix helps in migrating of Sage CRM from Salesforce | ACT! | SalesLogix | Goldmine | Sugar CRM | Maximizer. Our Sage CRM Product Suite includes Greytrix Business Manager, Sage CRM Project Manager, Sage CRM Resource Planner, Sage CRM Contract Manager, Sage CRM Event Manager, Sage CRM Budget Planner, Gmail Integration, Sage CRM Mobile Service Signature and Sage CRM CTI Framework.

Greytrix is a recognized Sage Rockstar ISV Partner for GUMU™ Sage Enterprise Management – Sage CRM integration also listed on Sage Marketplace.

For more information on our integration solutions, please contact us at sage@greytrix.com. We will be glad to assist you.