In this video we’re going to take a look at creating and using variables of type XML and String.
The ability to create variables was introduced in ADM form 6.5. To create variables, let’s create a work-flow model and open it Edit Mode, and then we go to this new tab which allows you to create variables. Click on Add Variable here and I’m gonna create a variable which will hold the SubmittedData of my Adaptive Form submissions. I will store it in variable type XML. So whenever you are creating an Adaptive Form, then it is either in an XML format or in an JSON format. So in this case, my submitted data will be in an XML format and that’s the reason my variable is going to be of type XML. I click on that here.
The next variable I am gonna create is to hold the submitter’s e-mail.
So this will hold the e-mail of the person submitting the form and this is going to be of type String.
So, so far I have created two variables; one to hold a submitted data and the other one to hold the submitter e-mail. So once these variables are created, the next step is to initialize these variables, and initialize these variables we make use of a new component called Set Variable.
Add the Set Variable to my work-flow model and open it’s configuration properties. Tap to the mapping tab and we map the variables here. The first variable that we need to map is the SubmittedData. So we map the SubmittedData here.
Select the mapping mode, it’s going to be Relative to Payload, and we do Data.xml. So make sure this Data.xml is the same name you provide when configuring your submit options of the Adaptive Form. The next mapping we need to do is for this SubmitterE-mail, so we click on the arrow, Mapping, the Map Variable. Scroll down here. We select the appropriate variable, here SubmitterE-mail. We select the mapping mode, is going to be XPath. We select the variable here, SubmittedData, and then we give the XPath for the XML variable, so here. So, the XML, the e-mail element, will be stored under /afData/afBoundData/Employee/Email. So employee and e-mail are my XML scheme elements, and afBound and afBoundData is something which AEM bounds add when an Adaptive Form based on a schemer is submitted. Then I do Save Here.
So, so far we updated two variables and then the mapping. The next thing we need to do is to use an Assign Task here, so I click here, and add an Assign Task here.
Open the pix configuration properties.
We select the Form/Document. Adaptive Form we’re gonna say available submitted to the workflow. So what this means is pick up the name of the Adaptive Form from the data that was submitted to the work-flow, and then for the Pre-population here, we’ll select a variable, and the variable is going to be SubmittedData here.
Then we go to the Assignee section; this is the same as AEM 6.4. We select a default here? or Administrator. Actions, we are not going to change anything. Advanced, we leave it as it is. Then we save it.
So to summarize, we created two variables, we initialized those variables and we used one of those variables in our Assign Task.