Executing a Business Rule via the Infor CRM SData API from T-SQL

I had the need to call a business rule in Infor CRM from a stored procedure in SQL. This turned out to be a relatively easy task, although you want to make sure you think through what you’re doing for this to not introduce performance problems in SQL. Keep in mind, sometimes SData requests can take a bit to execute, not to mention that you’re calling this via HTTP and doing it all via OLE automation using MSXML2.ServerXMLHttp. With all that in mind, here’s how it’s done.

First, you need to make sure that OLE Automation Procedures in SQL have been enabled. You can do that with the following:

With that turned on, you can now use things like sp_OACreate, etc, which we’ll need to do the HTTP Posts to SData. In this example, my business rule is for the ERPShipTo entity and does not take any additional parameters.

That’s it. If you’re not sure what parameters are needed for your business rule request, you can open this in a browser to see what parameters it is expecting (of course, replace the entity and rule names):

Ryan Farley is the Director of Development for Customer FX and creator of slxdeveloper.com. He's been blogging regularly about SalesLogix, now Infor CRM, since 2001 and believes in sharing with the community. He loves C#, Javascript, web development, open source, and Linux. He also loves his hobby as an amateur filmmaker.