EDI Integration with Dynamics SL Using Catalina

If you need EDI integration between your trading partners and Dynamics SL, you can use Catalina’s API for SL to get data in and out of Dynamics SL. One of the simplest of transactions is order management. If you have a trading partner that needs to send you PO’s so that you can then fulfill, the most common documents used are:

  • Inbound Documents
    • 850: This is a purchase order to fulfill
  • Outbound Documents
    • 855: An immediate response sent back to your trading partner acknowledging that you received the transaction
    • 997: An acknowledgement that you have received the transaction and often when you will pass back a reference number for your internal order number
    • 856: A shipper notification that notes what has shipped on the PO when a shipper is generated

The key to this is a data mapping layer that allows you to translate the inbound EDI documents and transform it into something that the Catalina API can understand. The reverse is true when data needs to be sent from SL out to your trading partner. The Catalina API will retrieve the data and then the translation will transform that data into an EDI document to send back to your customer.

If you have questions or need assistance with EDI integration with DynamicsSL, you can contact Catalina at [email protected]


SL Quick Pay tips and tricks

How to Custom Call Stored Procedures with REST that have Customizable XML Parameters

Many of Catalina Technology’s stored procedures accept a field called @parms that is an XML field for configurable parameters to be passed. An example of this is below.

You can see that there is a parameter getting passed called “@parms”. In that is a XML string that contains one or more parameter. In this case, there is a single parameter called “ADDRID” and it is getting passed the value of “C%” so that it can return all addresses that start with a “C”

exec xct_spDSLGetAddresses @currentPageNumber=N'0',@pageSize=N'500',
@parms=N'<nameValuePairs>
    <key name="ADDRID" value="C%"/>
</nameValuePairs>'

To call this RESTfully, you need to HTML escape the XML string so that things like double quotes (“) will not cause the JSON to break.

Below is an example of how we would call the custom stored procedure above, but call it through the Catalina RESTful API.

curl --location --request POST 'http://YOURSERVER/ctDynamicsSL/api/customSQL/xct_spDSLGetAddresses' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Basic YOURAUTH' \
--header 'SiteID: YOURSITEID' \
--header 'CpnyID: YOURCPNYID' \
--data-raw '{ 
    "parameters": 
    [
        { 
        "name": "currentPageNumber", "value": "0"
        },
        { 
        "name": "pageSize", "value": "0"
        },
        { 
        "name": "parms", "value": "<nameValuePairs><key name=\"ADDRID\" value=\"C%\"/></nameValuePairs>"
        } 
    ]
}'


SL Quick Pay tips and tricks

Catalina XML Configuration File Editor: ctConfigEditor

ctConfigEditor is the stand-alone executable used to create and edit the custom XML documents used to configure our full line of web services. Our xml structure supports storing sql connection data and a range of name/value pairs. All data is easily encryptable for added security.

Step 1:

Choose whether you are editing an existing file or creating a new config file from scratch. If loading an existing config file, you will need to fill in your catalina software license key as well as your sitekey.

Step 2:

Either load an existing Site ID or create a new Site ID.
You can identify which Site ID you are editing on all screens at the top of the screen where it says, “Currently Editing: SiteID“. If this value is blank, it means you are creating a new SiteID entry.
Note: TO DEFAULT ALL KEYS: Load an existing Site ID, then enter a New Site ID and hit the “Create Site” button.

Step 3:

Set your Database connection strings. Both the .NET format and OLE String format.
.NET Format:  user id=USERNAMEHERE;password=PASSWORDHERE;database=DATABASENAMEHERE;server=SERVERNAMEHERE
OLE Format:  Provider=SQLOLEDB;User Id=USERNAMEHERE;Password=PASSWORDHERE;Initial Catalog=DATABASENAMEHERE;Data Source=SERVERNAMEHERE
For more information on sql connection strings and other options available, we recommend reading at: http://www.connectionstrings.com/

Step 4:

Edit the config options available or create custom entries. Note: you can optionally encrypt any field by just checking the “encrypt” checkbox next to a key. We recommend only encrypting sensitive data.

Step 5:

On the “Finish” tab you will see the option to Preview the XML file or Save it to a file. Click the appropriate button.
You can optionally change your siteKey/encryptKey by filling in the new key in the SiteKey text field. Note: You will need to remember to update any client applications to use the new siteKey.


Catalina API Error Not Able to Load Assembly

Question

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

  <system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" />
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />
    </compilers>
  </system.codedom>

Call Custom Stored Procedure via Catalina’s RESTful API for Dynamics SL

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)

Example using one of our procedures:

/api/customSQL/xct_spDSLvalidateContactID

{ 
    "parameters": 
    [
        { 
        "name": "ContactID", "value": "BJON"
        } 
        ,
        { 
        "name": "CustID", "value": "CT0100"
        } 
        ,
        { 
        "name": "Type", "value": "B"
        } 
    ]
    ,
    "checkSum": "3CB06C9A4A83BECCFC60684C271818EDEEAA5770" 
}

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);





Create Sales Orders with ctAPI

Using ctAPI to Create Sales Orders

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.

{
	"SOTypeID":"SO",
	"ShipViaID":"BEST",
	"CustID":"C300",
	"ShipToID":"DEFAULT",
	"orderItems": [
        {
        	"InvtID":"0RCRANK",
        	"QtyOrd":1,
        	"CurySlsPrice":-999876,
        	"CuryCost":-999876,
        	"Taxable":1
        }
     ]

}

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.

curl -X POST \
  http://yourservername/ctDynamicsSL/api/orders/sales/order \
  -H 'Accept: application/json' \
  -H 'Authorization: Basic YOURAUTHORIZATIONHERE' \
  -H 'Content-Type: application/json' \
  -H 'CpnyID: 0060' \
  -H 'SiteID: DEFAULT' \
  -H 'cache-control: no-cache' \
  -d '{
	"SOTypeID":"SO",
	"ShipViaID":"BEST",
	"CustID":"C300",
	"ShipToID":"DEFAULT",
	"orderItems": [
        {
        	"InvtID":"0RCRANK",
        	"QtyOrd":1,
        	"CurySlsPrice":-999876,
        	"CuryCost":-999876,
        	"Taxable":1
        }
     ]

}'

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)