Last week, I posted a video for a demo on how to use our REST API to integrate to projects in Dynamics SL. This one uses our SOAP based Web Services to do the same thing.
If you use the Catalina Queue Engine for queuing records, you might want to retrieve data in a FIFO (First In First Out) method. This means you want to grab the oldest records first. This is easily accomplished by calling the Catalina Queue API with the parameter sortBy in the query string.
Example, if you are retrieving the queue ORDERS, you would format your URL, for the Queue API, like this:
If you are going to use our userMaintenance web service, to manage SL user logins, it will also need: db_securityadmin db_accessadmin
Also note that by default, we normally install our scripts under the dbo schema. So, you also have to give the user, we are connecting as, execute on that schema.
eg. grant execute on schema :: [dbo] to usernamehere
There have been quite a few requests for the code for my MQTT posting IOT project for testing PH and Temperature of my hydroponic towers. This code is several years old and I haven’t looked at it for at least 2. But, I figured I would put it out on GitHub.
The main purpose of this code is to monitor the PH and temperature in a water tank for my hydroponics and then use MQTT to post to io.adafruit for a dashboard.
Catalina’s evergrowing list of API’s for Dynamics SL increases your capabilities to integrate other systems and apps to SL quickly and easily with modern API technology.
If you are like me, you spend a lot of time in Microsoft SQL Server. Often, a trigger can cause you a lot of grief. Whether it is a recursive trigger that goes into an endless loop. Or a trigger that is updating data in the recordset that you are trying to save (causing problems in your client code).
Here is a quick way to get a list of all triggers in a particular DB
SELECT
sysobjects.name AS trigger_name
,USER_NAME(sysobjects.uid) AS trigger_owner
,s.name AS table_schema
,OBJECT_NAME(parent_obj) AS table_name
,OBJECTPROPERTY( id, 'ExecIsUpdateTrigger') AS isupdate
,OBJECTPROPERTY( id, 'ExecIsDeleteTrigger') AS isdelete
,OBJECTPROPERTY( id, 'ExecIsInsertTrigger') AS isinsert
,OBJECTPROPERTY( id, 'ExecIsAfterTrigger') AS isafter
,OBJECTPROPERTY( id, 'ExecIsInsteadOfTrigger') AS isinsteadof
,OBJECTPROPERTY(id, 'ExecIsTriggerDisabled') AS [disabled]
FROM sysobjects WITH(NOLOCK)
INNER JOIN sys.tables t WITH(NOLOCK)
ON sysobjects.parent_obj = t.object_id
INNER JOIN sys.schemas s WITH(NOLOCK)
ON t.schema_id = s.schema_id
WHERE sysobjects.type = 'TR'
You will get a result like this that will list out the triggers and which tables they are tied to.
We often get requests to integrate ecommerce or other systems to Dynamic SL’s Order Management module. Basically creating sales orders from shopping carts, CRM’s, Point of Sales, Mobile Apps, etc.
It is pretty easy to create sales orders in SL using Catalina’s API with a minimal amount of work. I am going to focus on the REST version of the API and show how you can create a sales order using Postman. From there, you can apply that to whatever client application you may be developing in.
The first thing that you do is look in Swagger to determine how to use the API. The swagger documentation, for the API, is located:
http://yourservername/ctDynamicsSL/swagger
Where “yourservername” is the server that the Catalina API is installed on.
NOTE: ctDynamicsSL may be located in a different virtual path. Check with your server administrator.
Below you can see an example of the swagger documentation. You will need to enter your API key and password, CpnyID, and SiteID in the top navigation bar if you want to use the swagger tools to test code. In this example, we are just getting the usage information on how to save an order.
Clicking on the Orders resource of the API you can then look at the POST method. This is the method that allows you to save new orders. It also gives you the format of the order object you would pass to the API.
Now you have this information, you now know how to send data to the API. Below is an example of one of the most simplest orders to create. There is very little required. You would replace the values with the values that match what your SL system accommodates.
NOTE: notice the CurySlsPrice and CuryCost. If you put either of those to the secret number of -999876, this will tell the Catalina API to have Dynamics SL calculate the pricing. If you put any other number, your number will be what is saved in the line item as the price.
Here is how you can put it together in a curl code. This gives you the information on how to use the URL (NOTE: you will have to replace yourservername with your actual server) and change the authorization to what your authorization is setup on your server.
And below, you can see how you can enter it into Postman. NOTE how the API passes back the order object to you once it is created. If there is an error, the order object will be passed back mostly blank with the field errorString as not empty (meaning the error will be stored in the field errorString)