When using Invoke Form Data Model in a workflow step, you now have the option to use a particular value in the JSON data as an input parameter to another Form Data Model Service. 

For example, the following is data returned by Form Data Model Service Invocation. This data is stored as JSON file relative to the workflow payload.

 We can access the id element by the dot notation- user.id and pass the id value as an input parameter to another Form Data Model Service.

"user": { "zip": "95110", "address": "345 Park Ave", "possibleWithdrawals": 4190, "city": "San Jose", "name": "Gloria Rios", "currentContributions": 1589, "state": "CA", "id": "123", "onlineBanking": "0", "directDeposit": "1" }

If you are invoking another Form Data Model Service and need to pass the user.id value as an input parameter, you can use JSON Xpath to access the id element of the user object

The following screen shot would make it easier for you to understand how to use JSON xpath

newscreenshot

In the Service Input tab, we are mapping input fields for the Form Data Model's service from the JSON file that is stored relative to this workflow's payload. The name of the JSON file is accountdetails.json. 

The input parameter to the Form Data Model Service method is called ssn. We then pass the value of user.id field to the FDM Service method

To test this capability - Please download the assets file. Import the UsingXpathInFDM .zip using the package manager. The zip file contains the following assets

        Workflow Model

        Adaptive Form

        Form Data Model

You will also need to have tomcat installed and have the WAR file deployed.

The steps to do that are mentioned here. These steps should not take more than 30 minutes to complete.

Open the CreditApplicationForm

Fill in the details and hit the submit button

This will trigger the workflow. The first step in the workflow will fetch the user data and store the JSON file relative to the payload. The second step will invoke another FDM Service and fetch the credit score of the user. The credit score is stored as workflow metadata property.

You can explore the workflow model here

To view the JSON file that is stored relative to the payload, please login to crx and navigate to  /var/workflow/instances/server0 and drill down to the appropriate workflow instance.

The workflow model

Download

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy