When using the xfaForm or Document Form variable it is extremely easy to set and get data if your form has an associated schema. Here is a basic recipe for setting and getting data from within an XFA based form in a LiveCycle process.
LiveCycle Version: 8.2.1
Here is a completed example with LCA: setget1
- One XFA Form
- One Schema
- Generate an xml file that will represent your form data:
- Generate schema based on the form data. There is a great little web utility that will do this for you here: Generate XML Schema
- Build a form based on the schema
- Create a new form in LiveCycle Designer
- In the Data View panel select New Data Connection
- Specify your schema and choose the option to embed
- Drag items from the Data View onto your form and save resulting file in the repository
- Specify the form you just created as the template for your xfaForm or DocumentForm variable. If you can see the schema when you select Schema Settings you successfully embedded the schema. You can also load an external schema here.
- Now you can XPath directly to the form fields using the SetValue activity within your process and set or get data. If you want to pre-populate data before a form is presented you can use this technique within your render service.
Note: I strongly recommend using schema. However, if you are not using one, you can still XPath to items within a form using the // syntax e.g.