{"id":326,"date":"2011-06-08T05:30:00","date_gmt":"2011-06-08T05:30:00","guid":{"rendered":"http:\/\/www.greytrix.com\/blogs\/sagecrm\/?p=326"},"modified":"2018-09-14T12:43:40","modified_gmt":"2018-09-14T12:43:40","slug":"generate-saleslogix-next-record-id-via-sql","status":"publish","type":"post","link":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2011\/06\/08\/generate-saleslogix-next-record-id-via-sql\/","title":{"rendered":"Generate Saleslogix Next Record Id via SQL"},"content":{"rendered":"<p>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.<\/p>\n<ol>\n<li>We will have to create a dll which will be used in SQL as assembly.<\/li>\n<li>The function coded in the dll would have this code<br \/>\nOleDbCommand cmd = new OleDbCommand(string.Format(&#8220;slx_dbids(&#8216;{0}&#8217;, {1})&#8221;, &#8220;ACCOUNT&#8221;, 1), );<\/li>\n<li>Here the key thing is to have the SLXOLEDB.1 in your connection string and have the stored procedure executed using the OleDBCommand because \u201cslx_dbids\u201d function works only with SLXOLEDB.1.<\/li>\n<li>Before compile the project make sure you have check the \u201cAllow unsafe code\u201d checkbox =\u201dTrue\u201d from .NET project properties.<\/li>\n<li>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.<b><\/b><\/li>\n<\/ol>\n<p><span style=\"font-size: Medium;\"><strong>About Us<\/strong><\/span><br \/>\n<a href=\"https:\/\/www.greytrix.com\/\">Greytrix<\/a> 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.<\/p>\n<p><a href=\"https:\/\/www.greytrix.com\/\">Greytrix<\/a>\u00a0has some unique integration solutions for Sage CRM with Sage ERPs (<a href=\"https:\/\/www.greytrix.com\/product\/sage-crm\/gumu-sage-x3-integration\">Sage Enterprise Management (Sage X3<\/a>),\u00a0<a href=\"https:\/\/www.greytrix.com\/product\/intacct-apps-and-products\/gumu-sage-intacct-sage-crm-integration\">Sage Intacct<\/a>, <a href=\"https:\/\/www.greytrix.com\/product\/sage-crm\/gumu-sage-100-erp-integration\">Sage 100<\/a>,\u00a0<a href=\"https:\/\/www.greytrix.com\/product\/sage-crm\/gumu-sage-500-erp-integration\">Sage 500<\/a>\u00a0and\u00a0<a href=\"https:\/\/www.greytrix.com\/product\/sage-crm\/gumu-sage-300-erp-integration\">Sage 300<\/a>).We also offer best-in-class\u00a0<a href=\"https:\/\/www.greytrix.com\/product\/erp-development\/sage-x3\">Sage ERP<\/a> and <a href=\"https:\/\/www.greytrix.com\/product\/crm-development\/sage-crm\">Sage CRM<\/a> customization and development services\u00a0to\u00a0Business\u00a0Partners,\u00a0End\u00a0Users and Sage PSG worldwide. Greytrix\u00a0helps in\u00a0migrating of Sage CRM from <a href=\"https:\/\/www.greytrix.com\/resources\/sage-erp-crm-migration.pdf\">Salesforce | ACT! | SalesLogix | Goldmine | Sugar CRM | Maximizer<\/a>. Our Sage CRM Product Suite includes <a href=\"https:\/\/www.greytrix.com\/product\/sage-crm-add-ons\/business-manager\">Greytrix Business Manager<\/a>, <a href=\"https:\/\/www.greytrix.com\/product\/sage-crm-add-ons\/sage-crm-project-manager\">Sage CRM Project Manager<\/a>, <a href=\"https:\/\/www.greytrix.com\/product\/sage-crm-add-ons\/sage-crm-resource-planner\">Sage CRM Resource Planner<\/a>, <a href=\"https:\/\/www.greytrix.com\/product\/sage-crm-add-ons\/sage-crm-contract-manager\">Sage CRM Contract Manager<\/a>, <a href=\"https:\/\/www.greytrix.com\/product\/sage-crm-add-ons\/sage-crm-event-manager\">Sage CRM Event Manager<\/a>, <a href=\"https:\/\/www.greytrix.com\/product\/sage-crm-add-ons\/sage-crm-budget-planner\">Sage CRM Budget Planner<\/a>, <a href=\"https:\/\/www.greytrix.com\/product\/sage-crm-add-ons\/gmail-integration-for-sage-crm\">Gmail Integration<\/a>, <a href=\"https:\/\/www.greytrix.com\/product\/sage-crm-add-ons\/sage-crm-mobile-service-signature\">Sage CRM Mobile Service Signature<\/a> and <a href=\"https:\/\/www.greytrix.com\/product\/sage-crm-add-ons\/sage-crm-cti-framework\">Sage CRM CTI Framework<\/a>.<\/p>\n<p>Greytrix is a recognized <a href=\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2017\/07\/26\/greytrix-on-boards-sage-global-rockstar-isv-program-with-gumu-for-sage-crm-sage-x3-solution\/\">Sage Rockstar ISV Partner<\/a> for GUMU&#x2122; Sage Enterprise Management \u2013 Sage CRM integration also listed on <a href=\"https:\/\/www.sage.com\/marketplace\/asb_ListingDetail?listingId=a1h24000007PC3aAAG\" target=\"_blank\" rel=\"noopener\">Sage Marketplace<\/a>.<\/p>\n<p>For more information on our integration solutions, please contact us at\u00a0<a href=\"mailto:sage@greytrix.com\">sage@greytrix.com<\/a>. We will be glad to assist you.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2011\/06\/08\/generate-saleslogix-next-record-id-via-sql\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[1669,2166,2301],"class_list":["post-326","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-next-id","tag-sage-saleslogix","tag-slxdbids"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Generate Saleslogix Next Record Id via SQL - Sage CRM \u2013 Tips, Tricks and Components<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2011\/06\/08\/generate-saleslogix-next-record-id-via-sql\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Generate Saleslogix Next Record Id via SQL - Sage CRM \u2013 Tips, Tricks and Components\" \/>\n<meta property=\"og:description\" content=\"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\u2026 Read More &raquo;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2011\/06\/08\/generate-saleslogix-next-record-id-via-sql\/\" \/>\n<meta property=\"og:site_name\" content=\"Sage CRM \u2013 Tips, Tricks and Components\" \/>\n<meta property=\"article:published_time\" content=\"2011-06-08T05:30:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-09-14T12:43:40+00:00\" \/>\n<meta name=\"author\" content=\"greysagecrm\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"greysagecrm\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2011\/06\/08\/generate-saleslogix-next-record-id-via-sql\/\",\"url\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2011\/06\/08\/generate-saleslogix-next-record-id-via-sql\/\",\"name\":\"Generate Saleslogix Next Record Id via SQL - Sage CRM \u2013 Tips, Tricks and Components\",\"isPartOf\":{\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/#website\"},\"datePublished\":\"2011-06-08T05:30:00+00:00\",\"dateModified\":\"2018-09-14T12:43:40+00:00\",\"author\":{\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/#\/schema\/person\/e7ff1c8f4763b47730d6bc5e74d59c1f\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2011\/06\/08\/generate-saleslogix-next-record-id-via-sql\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2011\/06\/08\/generate-saleslogix-next-record-id-via-sql\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2011\/06\/08\/generate-saleslogix-next-record-id-via-sql\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Generate Saleslogix Next Record Id via SQL\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/#website\",\"url\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/\",\"name\":\"Sage CRM \u2013 Tips, Tricks and Components\",\"description\":\"Explore the possibilities with Sage CRM insights through our comprehensive blogs. As a leading Sage partner, Greytrix helps businesses maximize their Sage CRM potential with its rich expertise and immense knowledge. Here, you will find blogs that feature expert advice, tips &amp; tricks, best practices, and comprehensive guides on customizing and configuring Sage CRM for your business. Stay informed with our regular updates and expert insights!\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/#\/schema\/person\/e7ff1c8f4763b47730d6bc5e74d59c1f\",\"name\":\"greysagecrm\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/c3b4325cb326e36467f945b9b9adf2bb85e907fe092d42eb36b39743b492e626?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/c3b4325cb326e36467f945b9b9adf2bb85e907fe092d42eb36b39743b492e626?s=96&d=mm&r=g\",\"caption\":\"greysagecrm\"},\"url\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/author\/greysagecrm\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Generate Saleslogix Next Record Id via SQL - Sage CRM \u2013 Tips, Tricks and Components","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2011\/06\/08\/generate-saleslogix-next-record-id-via-sql\/","og_locale":"en_US","og_type":"article","og_title":"Generate Saleslogix Next Record Id via SQL - Sage CRM \u2013 Tips, Tricks and Components","og_description":"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\u2026 Read More &raquo;","og_url":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2011\/06\/08\/generate-saleslogix-next-record-id-via-sql\/","og_site_name":"Sage CRM \u2013 Tips, Tricks and Components","article_published_time":"2011-06-08T05:30:00+00:00","article_modified_time":"2018-09-14T12:43:40+00:00","author":"greysagecrm","twitter_card":"summary_large_image","twitter_misc":{"Written by":"greysagecrm","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2011\/06\/08\/generate-saleslogix-next-record-id-via-sql\/","url":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2011\/06\/08\/generate-saleslogix-next-record-id-via-sql\/","name":"Generate Saleslogix Next Record Id via SQL - Sage CRM \u2013 Tips, Tricks and Components","isPartOf":{"@id":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/#website"},"datePublished":"2011-06-08T05:30:00+00:00","dateModified":"2018-09-14T12:43:40+00:00","author":{"@id":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/#\/schema\/person\/e7ff1c8f4763b47730d6bc5e74d59c1f"},"breadcrumb":{"@id":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2011\/06\/08\/generate-saleslogix-next-record-id-via-sql\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.greytrix.com\/blogs\/sagecrm\/2011\/06\/08\/generate-saleslogix-next-record-id-via-sql\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2011\/06\/08\/generate-saleslogix-next-record-id-via-sql\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/"},{"@type":"ListItem","position":2,"name":"Generate Saleslogix Next Record Id via SQL"}]},{"@type":"WebSite","@id":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/#website","url":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/","name":"Sage CRM \u2013 Tips, Tricks and Components","description":"Explore the possibilities with Sage CRM insights through our comprehensive blogs. As a leading Sage partner, Greytrix helps businesses maximize their Sage CRM potential with its rich expertise and immense knowledge. Here, you will find blogs that feature expert advice, tips &amp; tricks, best practices, and comprehensive guides on customizing and configuring Sage CRM for your business. Stay informed with our regular updates and expert insights!","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/#\/schema\/person\/e7ff1c8f4763b47730d6bc5e74d59c1f","name":"greysagecrm","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/c3b4325cb326e36467f945b9b9adf2bb85e907fe092d42eb36b39743b492e626?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c3b4325cb326e36467f945b9b9adf2bb85e907fe092d42eb36b39743b492e626?s=96&d=mm&r=g","caption":"greysagecrm"},"url":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/author\/greysagecrm\/"}]}},"_links":{"self":[{"href":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/wp-json\/wp\/v2\/posts\/326","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/wp-json\/wp\/v2\/comments?post=326"}],"version-history":[{"count":3,"href":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/wp-json\/wp\/v2\/posts\/326\/revisions"}],"predecessor-version":[{"id":20418,"href":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/wp-json\/wp\/v2\/posts\/326\/revisions\/20418"}],"wp:attachment":[{"href":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/wp-json\/wp\/v2\/media?parent=326"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/wp-json\/wp\/v2\/categories?post=326"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/wp-json\/wp\/v2\/tags?post=326"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}