ERP Integration
One of the most common integrations with Propel is an integration with an Enterprise Resource Planning (ERP) System. Common ERP Systems customers integrate with include SAP, Microsoft Dynamics, Netsuite, and Oracle Cloud. While each system handles product data uniquely, there are some generic patterns that can be used to retrieve all necessary data out of Propel. This article's purpose is to provide a middleware agnostic approach to fetching product data from Propel used to populate your ERP system.
ERP Integration Partners
If you are in need of an ERP Integration and do not have in-house development resources, please contact your Account Manager to learn more about our recommended ERP Integration partners.
Realtime Integrations (Recommended)
By far, the most common use case is what we call the "Product Master". This use case entails transfering Product data from Propel to your downstream ERP System in order to facilitate additional business processes along the value chain.
Data is transferred on a per Change Order basis, preferrably in realtime. The data needed to populate ERP includes Affected Items (including Item and Item Revision data), Bill of Materials (BOMs), and Approved Manufacturers Lists (AMLs). Please see the Core Objects ERDs for more information about how these objects are related from a data model perspective.
Architecture
This architecture assumes a realtime integration which is a recommended best practice.
The sequence of events can be defined at a high-level as such:
- The data exchange begins with an event, the release of a Change Order in Propel.
- When a Change Order is released, either a Platform Event or Outbound Message is triggered and received by your Middleware of choice. Either messaging technology can be used based on your Middleware's compatibility.
- Your Middleware can then use our REST API to fetch the Release Package for the Change Order.
- Your Middleware performs transformations and translations and inserts the data into your ERP System.
Express App as Middleware Example
In this example, we'll setup an Express app to act as the Middleware and receive notifications when Change Orders are released and then fetch their Release Packages. You can access the full sample code here.
We'll be doing the following in this example:
- Create a Connected App if Using OAuth (Optional)
- Create an Express App
- Authenticate with Propel
- Receive Platform Event Messages
- Fetch the Release Package for a Change Order
1. Create a Connected App if Using OAuth (Optional)
tip
Only follow this step if you plan to use OAuth instead of basic authentication. This example uses basic username/password authentication.
First, you'll need to open a connection with Salesforce in order to make API calls. You will get a client and secret key after creating a connected app.
- In Salesforce Lightning, Go to Salesforce Setup > App Manager
- Click
New Connected App
on the App Manager page - Name:
ERP Integration
, API Name:Propel_ERP_Integration
, Contact Email:your_email
- Enable OAuth Settings
- Callback URL:
http://localhost:4000/oauth2/callback
- Selected OAuth Scopes:
(full), (api), (web), (refresh_token, offline_access)
It is recommended to have at least these four scopes selected. - Save
Make sure to save your client and secret key for connecting your application. You'll need it in the next steps.
2. Create an Express App
Create a new folder and create a package.json
file with the following to ensure you have installed the right dependencies:
In this example, we'll be using two libraries, JSForce
and Express
. JSForce
will allow us to easily authenticate and make API calls to Propel and Express
will be our server that will handle routing.
Once you've copied package.json
, run npm install
in your command line to install the required libraries.
Now that you have your dependencies installed, create index.js
. Add the following code to your file:
You can now type node index.js
into command line to run the server.
3. Authenticate with Propel
Next, we'll authenticate with Propel using a basic authentication scheme. Open config.editme.js
from the code sample repository and fill in your Username, Password (may require security token as well), and Namespace (use PDLM
).
Once you've entered your credentials, rename the file to config.js
.
In index.js
add the following code after const namespace = config.namespace || 'PDLM'
to use your credentials to authenticate via Salesforce:
Run the command node index.js
to see if your authentication was successful. If it was you'll see the following message in the console:
4. Receive Platform Event Messages
After successfully authenticating, we're now ready to subscribe to the Platform Event that will let us know when a Change Order is released. For more information on Platform Events, please see this article.
In this example, we'll be subscribing to the PDLM__Change_Event__e
that is triggered anytime a change order transitions status.
Add the following code within the method you used to authenticate with Propel. Also, we'll introduce a helper method called withNamespace
to add the namespace to fields:
If you run node index.js
and create, update, or release a change order in Propel, you should see a response in the console similar to the following:
5. Fetch the Release Package for a Change Order
Finally, once we receive the Platform Event notifying us that a Change Order has been released, we can make a callout to the Release Package Endpoint (Since 6.4)
to fetch details about the Change Order and all related records such as Affected Items, BOMs, AMLs, and Attachments.
Add the following code within the authentication method:
First, we determine which URL Parameters to pass to the endpoint. In this case we've selected to fetch all Affected Items, BOMs, and AMLs associated with this Change Order.
Second, we filter Platform Event messages by release events only. The Is_Approved__c
flag determines if the triggering event was a release.
Third, we make a callout to the Release Package endpoint (/v3/change/:changeId
) using the Record_ID__c
from the Platform Event.
To test this code, run node index.js
and release a Change Order in Propel. Once you receive the payload from the Release Package endpoint, you will need to transform this data to insert it into your ERP system.
Batch Processing Integration
Try a Realtime Integration First
We highly recommend you build a realtime integration first, if possible. Realtime Integrations provide your users with more up-to-date, accurate mission critical data needed to make decisions.
In some cases, it may be required to query Propel periodically for Product data to update your ERP system. Please note, this is not our recommended approach, but may be necessary where realtime integrations are not viable due to various constraints (typically due to Middleware compatibility issues).
You can find more information about setting up this integration path in our Help Desk.