Ability to route adaptive forms based on data received from service invocation was introduced in AEM Forms 6.4 release. To demonstarte this capability we will consider the following use case

  • User submits mortgage application.
  • Service call is made using Form Data Model to fetch the applicants credit score.
  • The fetched credit score is stored as an metadata property in AEM.
  • Based on the credit score the Adaptive Form is routed to the appropriate person.

The following code shows you how to fetch the creditscore from the metadata property and route the form to the appropriate person in AEM workflow.

function check()
   var creditScore =workflowData.getMetaDataMap().get("creditscore","");
    log.info("Credit Score got is " + creditScore);
    var creditScoreInt=parseInt(creditScore);
    var comp = (creditScoreInt>500);
    log.info("Credit Score we got is  " + creditScoreInt);
    log.info("comp is " +comp);
           return true;
            return false;

To test this use case please follow the steps below to test the above-mentioned use case on your system

  • Deploy Tomcat as described here.
  • Deploy the SampleRest.war file into tomcat. (Copy SampleRest.war into webapps folder of your Tomcat installation).
  • Import loanapplicationV1.zip into AEM using the package manager.
  • Launch the mortgage application form by clicking here.
  • Fill out the necessary details including random number in the SSN field.
  • Submit the form.

On form submission, a workflow(loanapplication2) is triggered which gets the credit score of the applicant by passing the SSN entered in the form. Based on the credit score returned by the service, the form is routed to the appropriate user. Admin for good credit score and cavery for the bad credit score.

The workflow model associated with the form submission can be explored by clicking here


Troubleshooting tips:

Check for metadata properties

In the workflow 2 metadata properties are set:  ssn and creditscore. These can be confirmed by browsing to the appropriate workflow instance in crx . The following was the path on my server. 


If the creditscore metadata property is not being set, please follow the video below to re-import form data model in the Invoke Form Data Model Service step of the workflow

Make sure the Data File path in the Adaptive Form's submission options is set to "Data.xml". This is because the process step looks for a file called Data.xml under the payload folder

Re-Importing FDM

Re-Importing FDM