- Download the BPM JSON Helper Toolkit
- To install go to Process Center in the top right of your screen
- Click Toolkits
- Then Click Import toolkit
- twx file V3.1_8.5.0 included in the JSON Parser toolkit
- Go to the Process Designer in your process
- Add the toolkit in left column
- It may show a red error, you can ignore this as it will still function and is throwing an error due to version mismatch
How to Format JSON Parsing to TW and BPM
- Click all in the BPM JSON Helper toolkit
- Click Convert JSON to TWObject Sample
- Click JSON Convert to TW in the Human Service
- Parsing is called by this one line of text
- tw.local.sampleType = BPMJSON.convertJSONToTw(tw.local.jsonText);
- The tw.local.sampleType is an object that holds the configuration of what you're parsing
- the tw.local.jsonText is the JSON string to parse
Setting up your Implementation of the Parser
- Go to your data tab in the Process Designer
- Create a new data object
- You must have your object set up in the format â€śObjectNameâ€ť which is whatever you want to call the data object, in this case weâ€™ll call it EmailAddress. It does not need to correlate to anything, and is used for your reference.
- This complex object must have fields to map exactly to the JSON column name which matches to the SQL Column Name. In this case we can see the column name is emailaddress. So our EmailAddress object has a string called emailaddress.
- Go to your Systems Service where you are implementing the HTTP request to pull from the database. In my case this is called “Pull from DB”
- Create an output variable called emailAddress that is a list of the data objects we created.
- To summarize we are creating emailAddress, a list of objects of type EmailAddress that have one field called emailaddress of type string.
- First we must drop a piece of Client Side Script after we interact with the HTTP request to get our database information
- Place this code right after the Read from HTTP Integration Service
- Â In this we must first initialize our object.
- tw.local.emailAddress = new tw.object.listOf.EmailAddress
- After we have initialized our object we must convert the object through our JSON to TW Toolkit code. This code we found is the one line parser in Step 2.
- After the initialization add this code
- tw.local.emailAddress = BPMJSON.convertJSONToTW(tw.local.resultDB)
- This resultDB is the htmlResult returned from the â€śRead From HTTPâ€ť Integration service inside our systems service.
Viewing the Results Client Side in BPM
Go to your Client Side Human Service
Add a private variable of type EmailAddress called emailAddress. Ensure this is a list
Click on your coach so you can see the UI to place.
On the right side, drag your variable emailAddress on the screen.
Ensure that your data mapping on the Human service for the systems service is mapped from emailAddress of the Systems Service to emailAddress of the Client Side Service
- Launch your client side human service and see the result!
If you have any questions feel free to reach out to me. My email address is firstname.lastname@example.org
Special thanks to Kris Stowers for teaching me about JSON parsing inside BPM