Dynamics CRM and IsSOPIntegrationEnabled
There’s a little known and little documented feature of Dynamics CRM that comes in handy when you want to integration CRM with another system such as Dynamics AX or Dynamics GP. When this feature is turned on, it fundamentally changes how the out-of-the-box Order and Invoice entities function in CRM.
I recently experienced this first hand and wanted to document it so that it helps someone else.
This feature is really an integration mode that CRM offers to make it easier to integrate with AX, GP or other systems. The curious thing is that the mode can not be enabled via the CRM GUI. It either has to be set via an SDK app or via a direct update to the database.
In my case, the Dynamics Connector tool had been connected to CRM and a user had been marked as an “Integration User”. This caused a setting called “IsSOPIntegrationEnabled” to be set to true. This setting is on the Organization entity in CRM or the OrganizationBase table in the CRM database. If you’re using CRM Online, then you have no access to the database. The best way to enable or disable this setting is to use an SDK app and change the setting via the API. More on this in a moment.
The reason I stumbled upon this integration mode setting is that I noticed the change in behavior in the Order and Invoice entities. I have a ASP.NET web application that sends data to CRM. Specifically, it creates an Order and then calls CRM to create an Invoiced from that Order. While in a testing cycle, I noticed the following behavior changes:
- When using the custom web application to create an Order, the Order was being create with a Status of “Submitted” instead of “Active” and a Status Reason of “In-Progress” instead of “New”.
- The effect of the Order being created with this Status and Status Reason was that CRM rendered the Order as read-only. This caused the message that created the Invoice from the Order to fail because CRM refuses to create an Invoice from a read-only Order.
- The web application was not setting a specific Status or Status Reason.
- When creating an Order manually on the CRM form, CRM was throwing an invalid Status/Status Reason error message and preventing the Order from being created.
- This was odd because CRM was defaulting the Status to “Active” and the Status Reason to “New” as it should but CRM was still throwing the error.
- When creating an Invoice from an Order that had a Status of “Active” and a Status Reason of “New” caused the Invoice line items to have no dollar amounts. This caused the Invoice to have a blank total amount. The Invoice shouldn’t ever have a blank value amount.
- On the CRM form menu, the “Create Invoice” button was hidden and the “Submit Order” button had taken it’s place. So there was no way to manually create an Invoice for a given Order.
All of these changes were correct in that they were correct behavior for when the integration mode is enabled. The changes actually makes sense if you want an easy way for users to send an Order to the accounting system to have an Invoice created. Users can click the “Submit Order” button that will automate all of that.
However, it was causing my customizations to fail. So I needed to flip the IsSOPIntegrationEnabled setting to false, to make sure that it did indeed actually cause the behavior outlined above.
I used the following code in a .Net console Windows application to check the IsSOPIntegrationEnabled setting and set it to false. This code is using the CRM 2016 SDK. Simply toggling the IsSOPIntegrationEnabled flag will enable or disable the above behavior.