Question: Is it at all possible to dynamically write a form in Adeptia? For example, suppose that I want a human to select an item in a list in order to continue with the process flow, but I won’t know what items that list will contain until runtime because it’s generated from a document within the flow. I would like to be able to generate the list as XHTML (i.e. with a mapping) to display it to the user. I noticed that I can modify the email message using a Put-Context-Var, but evidently not the html form.
Answer: Yes it is possible to dynamically populate the form with run-time values.
1. First thing you need to insert list of items in the document into a Staging table (Ex- ItemList_table) , and make sure all the rows (Items) inserted from one document will point to the Same unique ID let us suppose "batchID". This batchId will be used further to fetch item list in the Adeptia Form.
2. Create a Web Form using Manual HTML option. To see how to create a Webform using Manual HTML option you can refer the UserGuide.
While creating HTML form manually , Call a Function on form loading which will call an Ajax function to fetch the document information from the database based on "batchID".
Now The HTML will look like as mentioned in the attached document.
3. In the Attached Document HTML , you need to replace the "SERVELETNAME" by your written servlet call which will fetch the item list. The radio button span defined in the HTML will get replaced dynamically by Ajax "getDocumentInformation"
Note: The Ajax function gives call to a servlet. This servlet will query the database for item List based on "batchID" and generate a HTML string in format you want your list to be displayed. This servlet need to be developed by you.
4. Now create the Humanworkflow activity using this WebForm.
5. While executing, when you will submit the form the Selected value will get stored in the variable name which you have given in your HTML for Radio buttons.This variable will be available in the Process flow context.