Catalina’s API for Dynamics SL can be used for many things. We can retrieve all types of data from SL. We can also save transactions to SL. In this demo I did for several folks, I am taking sensor data and pushing it through an advanced rules based engine to create Service Calls in Dynamics SL.
While this demo highlights Dynamics SL, we could just as easily use these same types of rules based development to integrate with other systems like CRM, helpdesk, field service, etc. We can monitor all types of things like temperature, barometric pressure, vibrations (helpful if you an HVAC company and need to monitor your customer’s properties for problems), humidity, ambient light, flooding, and more.
There are times that you might have questions or problems when developing using an API. You contact support and they will ask you to send you the “payload” you are using when communicating with the Catalina API for Dynamics SL. The easiest way to do this, if you are using Postman as your testing environment, is to export the code. This is done in these simple steps
Step 1: Got to your postman tab you are making the API call from and click on the “Code” link on the right of the screen
Step 2: On the popup, click on cURL and then copy the text provided, paste it into an email, and send to Support.
SLQuickCollect is Catalina’s solution that allows you to email or SMS message out a simple link to your customer as a request for payment.
Custom properties are a way to personalize the emails that go out to the customer. As well as the payment page and receipts they see. You can have an unlimited number of parameters with whatever text you want to send to the customer. And you can place it anywhere you want on the email and page templates.
Here is a quick demo on how you can do this via a RESTful API. And how to modify the templates to display the parameters.
Below is an example of a payload that you would send to the SLQuickCollect API.
CustID: The Customer ID of the customer you are sending the payment request to.
Amount: The amount you want to collect
PaymentEmailList: A delimited list of emails that the request is going to go to.
Properties: This is a list of properties as Name/Value pairs. You can create as many of these properties as you want. And then you can display them in the email, payment page, receipt email, and receipt page templates any way you want.
When you want to display a custom property on a template page, you use this ASP.NET format:
<%=getProperty(“PropertyName“)%>
So, if the property name is “COMMENTS”, you would use this:
It is simple to call a stored procedure through a RESTful API call if you have Catalina’s API for Dynamics SL. You can call any stored procedure and pass parameters and retrieve data.
This is a demo on how to call a stored procedure using Postman and Catalina’s API for Dynamics SL.
First, to do this demo, you need to download and install Postman. Postman is a developer tool that allows you to interact with API’s easily so that you can test API calls to see how you call them and what data is returned. You can get Postman here: https://www.postman.com/
In the demo, we are going to call the stored procedure SOHeader_all. This stored procedure retrieves all Sales Order Headers (SOHeader) for a particular CpnyID and OrdNbr. NOTE: this is just an example. With Catalina’s API, you can call any stored procedure.
SOHeader_all has 2 parameters: – @parm1: This parameter is for the CpnyID – @parm2: This parameter is for the OrdNbr (can use a wildcard like ‘O000%’ which will bring back all orders that start with O000.
You can see what the procedure looks like here:
PROCEDURE [dbo].[SOHeader_all]
@parm1 varchar( 10 ),
@parm2 varchar( 15 )
AS
SELECT *
FROM SOHeader
WHERE CpnyID = @parm1
AND OrdNbr LIKE @parm2
ORDER BY CpnyID,
OrdNbr DESC
So, if you wanted to retrieve all orders that started with “O000” for CpnyID = “0060” you would call the stored procedure like this:
exec SOHeader_all @parm1='0060', @parm2='O000%'
So, now how to call this using Postman through Catalina’s API for SL?
First you need to know where your Catalina API is installed. I am going to use the server name yourserver.com as the domain name. So, for this example, we would look at the endpoint as the following:
As you can see above, you would replace yourServer.com with wherever your server is. And you can see <ProcedureName> in the URL. this would be replaced with the actual stored procedure name you want to call (in this example, we are going to replace it with SOHeader_all). So, the new URL for the endpoint would look like the following:
In Postman, you would make it look like below. NOTE: when calling a customSQL stored procedure, you must use the action type of “POST”
Next, you need to set the authentication. This is done on the “Authorization” tab. Catalina’s API uses “Basic Auth”. So, make sure that you set the type for “Basic Auth” in the dropdown. And then enter the username and password that was given to you from your installer.
After that, you will have been given a SiteID from your installer. You will need to create a Header for that SiteID. You do this on the headers tab. You should enter that SiteID (in my example it is “DEFAULT”, but you would use the SiteID given to you by your installer) and the default CpnyID (in my example that is “0060”, but you would use your CpnyID of your database)
Finally, you will want to enter the body of the parameters that are being passed. There are 2 parameters for SOHeader_all (@parm1 and @parm2). The format of the body that you would set is below.
So, your Body tab in Postman would look like this (NOTE: make sure you select the “raw” radio button as shown below)
Then all you have to do is simply hit the “Send” button and the system should retrieve the results from your stored procedure call. In my example, it looks like below
Catalina’s SLQuickCollect is a way to send a request for payment to your customer as an email with a link to click to pay. Your customer simply clicks on it and pays (no need for a portal login or anything). The payment works through a PCI compliant payment processor and is automatically integrated back into Dynamic SL’s AR.
There are many ways to create SLQuickCollect links. One of which is calling a stored procedure by passing a few parameters.
The stored procedure is called: xct_spSLPaddInvoicePaymentRequest
The parameters to this proc is:
@batNbr: The batch number of the invoice you want to send
@refNbr: The invoice number you want to send
@CustID: The customer who the link is going to be going to
@paymentEmailList: A delimited list of email addresses the link will be sent to
@siteID: (optional) For which configuration site to use (defaults to ‘SLPAY’)
@setupID: (optional) The PayFabric setupID you are to send. If not passed, the default will be used from SLQuickCollect’s configuration
@deviceID: (optional) The PayFabric deviceID you are to send. If not passed, the default will be used from SLQuickCollect’s configuration
You can call this stored procedure from most anything. You could call it from a trigger when an invoice is created. You can call it from a SL screen. Or even another application all together (like maybe excel that has a list of invoices to send)
Here is an example of how I added a button on the Invoice and Memo screen to send a SLQuickCollect link for a particular invoice.
Below, you can see where I created a button “Send SLQuickLink” that will take the current invoice on the screen and send a payment request link to the customer.
Below is the code behind the click event of the button. This will look at the current batNbr, refNbr (invoice number), custID, and get the email tied to the customer to send the link to that customer’s email.
Private Sub bPayLink_Click()
Dim SQLStr As String
Dim Csr_temp As Integer
Dim sCustID As String
Dim recfound As Integer
Dim maintflg As Integer
sCustID = GetObjectValue("ccustid")
SQLStr = "Customer_All " + SParm(sCustID)
serr = SqlFetch1(Csr_temp, SQLStr, bCustomer, LenB(bCustomer))
Dim lsSQL As String
Dim liCursor As Integer
lsSQL = "xct_spSLPaddInvoicePaymentRequest" & SParm(ThisScreen.cbatnbr.Text) & SParm(ThisScreen.crefnbr.Text) & SParm(ThisScreen.ccustid.Text) & SParm(bCustomer.EMailAddr) & SParm("SLPAY")
Call sql(liCursor, lsSQL)
Call SqlFree(liCursor)
MsgBox ("SLQuickLink Sent to CustID " + ThisScreen.ccustid.Text + " for invoice " + ThisScreen.crefnbr.Text)
End Sub
When I try to access Catalina’s API for Dynamics SL, I am getting an error that looks like this. What is the problem, and how can I fix it?
Answer:
Look at the web.config of your ctDynamicsSL web application and remove the section <system.codedom>. So looking below, just remove this total section from your web.config
Catalina has had a way to call custom stored procedures from their SOAP based web services for Dynamics SL for years. You can now do it using the RESTful API version.
Looking at the Swagger Documentation, you can now see a customSQL resource (If you don’t see this, contact Catalina Support to see about getting updated to the latest version of Catalina API for Dynamics SL)
NOTE: the checksum is a security feature that is turned on by default. This allows the API to double check to make sure that you are who you say you are. Use a SHA1 hash of the stored procedure name to generate the checksum.
The checksum requirement can be disabled in your DSLCONFIGFILE.xml file.
You can generate the checksum using any SHA1 library, or you can use the library included in our service distribution: /ctDynamicsSL/bin/ctStandardLib.dll
var checksum = ctStandardLib.ctHelper.getHash(siteKey, storedProcedureName);
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 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.