Last updated November 2023
Sample Exercise: A2J Guided Interview & A2J PDF Template
This exercise was designed to teach you the basics of automating a document in A2J Author, creating both an A2J Guided Interview and an A2J PDF Template.
Here’s the document we’re going to automate. You can find the PDF Document to start with here. Save a copy of this PDF to your local machine.
There are two components to a completely automated document - the A2J Guided Interview which interacts with the end user and asks them questions, and the A2J PDF Template, which creates the actual document for the end user.
A2J DAT PDF Template
We’ll first focus on the A2J DAT PDF Template, then move on to creating the A2J Guided Interview.
-
Log into your www.a2jauthor.org account. If you aren’t sure how to create an account, check out this resource.
-
Once logged in, go to the “Author” tab and click it.
-
Then click “Run A2J Author”.
-
A2J Author will open on the “Interviews” Tab. Under “Create a new interview” double click on “Blank Interview.” This will open up a blank A2J Guided Interview. To learn more about authoring in A2J Author 6.0, check out our Authoring Guide.
-
Go to the About tab and change the title of your interview to Sample Exercise: A2J Guided Interview and A2J DAT PDF Template. You can select any guide avatar options to customize the Guide avatar. You should also click over to the Author tab inside the About tab in order to add your information as the author of this interview.
-
Go to the Templates tab. Click the “Create PDF Template” button in the top right hand corner. It will take you into the PDF Template tool.
-
The PDF Template tool lets you automate on top of an existing PDF document and maintain the existing formatting of that PDF. When you open the PDF Template Tool it will look like this:
-
Name your template. In the “Untitled Template” field in the left editing panel, delete “Untitled Template” and type in “Sample Exercise Template”. Hit the Save button underneath it. Your template is automatically saved every 5 minutes, but it doesn’t hurt to hit the “Save” button every so often, particularly after making several changes. Your last saved information will appear underneath the save button. Template.
-
Now we need to add the underlying PDF to the PDF Template Tool. Click the “Upload PDF” button in the center of the blank editing field. This will open your computer’s local file search tool.
-
Navigate to where you saved the PDF that we’ll automate in this Sample Exercise. (It’s here if you need to download it.) Select that file and click “Open”. A2J Author will convert the PDF to a PDF Template. It should look like this:
-
Now we’re going to start automating the template by inserting variables in all the blank spaces. This is all the information that the end user will need to complete the sample exercise document. To insert a variable field (a blank space on the template that will contain a variable), double click on the blank line. The first one we’re going to do is “Name” on the first line. See the gif. If you need to adjust the size of the variable field, you can do so by dragging the corners of the field to make the box taller, shorter, wider, or narrower. You can also manually draw fields by holding down your left click button on your mousepad and dragging the cursor to draw the box. If you need to adjust the placement of the field, you can click on it and drag it.
-
To add a variable to the field that you just created, right click on the yellow “unassigned variable” variable field. An “Assign variable” editor will pop up. Type the name of the variable into the editor and select the variable type. If it is a repeating variable (*a type of variable meant to hold multiple values for a repeat loop) check the “Check if multiple values” box. You can also add comments about this variable that can only be seen by authors. The “Text grouping” “Text overflow” and “Addendum label” selections can be ignored unless you want to group multiple fields together (to be used for a series of checkboxes or multiline text).
-
Create a text type variable with the name: User name full TE (see the gif above)
-
Make sure to allow for overflow if the end user’s response exceeds the lines provided by selecting the radio button that says “Append overflow text to an addendum”, then typing in User name in the Addendum label field. This tells A2J Author to automatically create an addendum and use the label you provided for all overflow text.
-
-
Create fields and assign variables for the following:
-
Today date DA
-
Type = Date
-
-
Address street TE
-
Type = Text
-
Make sure to allow for overflow if the end user’s response exceeds the lines provided by selecting the radio button that says “Append overflow text to an addendum”, then typing in Street address in the Addendum label field. This tells A2J Author to automatically create an addendum and use the label you provided for all overflow text.
-
-
-
Address city TE
-
Type = Text
-
Make sure to allow for overflow if the end user’s response exceeds the lines provided by selecting the radio button that says “Append overflow text to an addendum”, then typing in City in the Addendum label field. This tells A2J Author to automatically create an addendum and use the label you provided for all overflow text.
-
-
Address state MC
-
Type = Multiple Choice
-
-
Address zipcode TE
-
Type = Text
-
Make sure to allow for overflow if the end user’s response exceeds the lines provided by selecting the radio button that says “Append overflow text to an addendum”, then typing in Zipcode in the Addendum label field. This tells A2J Author to automatically create an addendum and use the label you provided for all overflow text.
-
-
Phone number TE
-
Type = Text today
-
* Note: Phone number variables are generally text variables because you are not going to use them for doing mathematical equations.
-
Make sure to allow for overflow if the end user’s response exceeds the lines provided by selecting the radio button that says “Append overflow text to an addendum”, then typing in Phone number in the Addendum label field. This tells A2J Author to automatically create an addendum and use the label you provided for all overflow text.
-
-
Marital status MC
-
Type = Multiple choice
-
There are a couple keyboard shortcuts built into the A2J DAT PDF Templates. If you create one box and size it to fit like you want, you can duplicate it to use on the other 3 fields. Create the one field and adjust the size to fit the first box. Then click on that box and hit Ctrl + D (control key and the "D" key) to duplicate it. You can then move it to cover another checkbox. This can be repeated with any field.
-
This multiple choice variable will cover the 4 boxes for marital status. So the same variable will be used for all four. Select “Draw a checkmark if the variable matches” for all 4. The difference will be what you insert in the “Multiple choice value” field.
-
Marrie
-
Single
-
Divorced
-
Widowed
-
-
It should look like this:
-
Have children TF
-
Type = True/False
-
This true false variable will be used for both the “Yes” and “No” option for the “Do you have children?” question. When you insert the “No” option, just check the “If the variable is false, draw the checkmark” option, like this:
-
-
Number of children NU
-
Type = Number
-
-
All live with user TF
-
Type = True/false
-
This true false variable will be used for both the “Yes” and “No” option for the “Do you have children?” question. When you insert the “No” option, just check the “If the variable is false, draw the checkmark” option.
-
-
For the “Why are you using this form today?” question, create fields on all five lines. (Remember the Ctrl + D trick mentioned above.) They will all have the same variable which is Purpose of form TE
-
Type = Text
-
We’re also going to group these fields together. We do this so that if the user’s answer is too long to fit on one line, it will flow to the other 4 lines.
-
Hold the Ctrl key down and select all five of the fields. Then right click. The variable dialog box will appear. Select “Group Selected Text Boxes”. This tells A2J Author to group all these fields together.
-
Make sure to allow for overflow if the end user’s response exceeds the lines provided by selecting the radio button that says “Append overflow text to an addendum”, then typing in Purpose of form in the Addendum label field. This tells A2J Author to automatically create an addendum and use the label you provided for all overflow text.
-
Your A2J PDF Template is now fully automated. It should look like this:
A2J Guided Interview
We are now going to create an A2J Guided Interview that will be paired with your A2J Template.
14. A new A2J Guided Interview comes pre-populated with 4 questions. We are going to have 11 questions in our practice A2J Guided Interview. So you will need to create 7 additional questions.
a. Click the New Page button at the top of the screen 7 times. Your screen should look like this:.
Blank Guided Interview with 10 questions.
-
Go to the Steps Tab. There are by default 4 steps. We will need to add 1 additional step. We also need to change the names of the steps.
-
Add an additional step by selecting 5 from the drop down menu.
-
Drop down menu to add an additional step to the default 4 and to change the name of the steps.
-
Change the name of the steps (See Figure 3 above)
-
Step (0) to INTRODUCTION
-
Step (1) to YOUR INFORMATION
-
Step (2) to FAMILY INFORMATION
-
Step (3) to PURPOSE OF FORM
-
Step (4) to THE END
-
16. Go to the Pages Tab
-
Click on the question (page) that is labeled 1- Introduction.
-
Scroll down to the text box. By default it says “This is the introduction.” Add “This A2J Guided Interview was created as part of a sample exercise. It is not intended for use by the general public.” Close that page.
-
-
Click on the question 2-Name.
-
Change the Step from 0 to 1.
-
Change the name to 1-Name (it is now the 1st question under Step 1, so the question numbering in the question name has to be changed. To learn more about question naming, check out this resource.)
-
Scroll down to the section labeled “Advanced Logic.” In this section, we are going to tell A2J Author to combine the end user’s first, middle, and last names into the variable [Client name full TE] that is used in our A2J template.
-
*NOTE: The brackets around the variable name in this sample exercise instruction set are only intended to separate the variable from the rest of the text. When creating variables, you should not use brackets in the variable name. However, you will need to use brackets in A2J Author when you place variable names into Advanced Logic, Macros, or Functions (see Figure 4 as an example).
-
To do this combination, we have to script some logic that tests if the end user has entered a middle name. If they have, then the variable [User name full TE] will include the values held by [Client first name TE] + [Client middle name TE] + [Client last name TE]. If they have not entered a middle name, then just the first and last name will populate [User name full TE]. If we didn’t include the logic as scripted below, there would be an odd extra space in [User name full TE] if the end user didn’t enter a middle name.
-
Type the logic exactly as it looks in Figure 4.
-
-
The Scripting Logic for testing if the user entered a middle name and setting the variable [User name full TE].
iv. Now you need to test to make sure the logic is working correctly. Click the button under the logic box (within your Question Design Window). This will take you into the A2J Viewer on this question.
- Open the Variables and Scripting Window by clicking this button
-
*Note: This is an excellent thing to have open during any testing you do in A2J Author. It allows you to see what is going on behind the scenes in your A2J Guided Interview.
-
Type in a first and last name in the question fields. Click “Continue.” Look in the scripting box and make sure the condition evaluated properly. It should look like Figure 5. To see the variables in the blue variables section, you may need to scroll down a bit to get to [Client first name TE], etc. The variables section shows the variables in alphabetical order.
Testing logic with no middle name.
- Now hit the Back button (the A2J Author internal one, not your browser’s back button) . This will take you back to the Name question.
-
Type in a first, middle, and last name. Click “Continue”. Look at the scripting box now and make sure it looks like Figure 6. If it does, then you have successfully scripted your first advanced condition! If not, go back and re-do the steps above.
Testing logic with a middle name.
-
Go back to the Pages Tab by clicking “Resume Edit” , then closing the Question Design Window for the Name page. Open the question called 3-Avatar by double clicking on it. Change the Step Number to 1 by clicking into the field labeled “Step.” A drop down menu of all your available steps will appear. Click Step 1. Change the name of the question to 2-Avatar by clicking into the Name field and typing it in.
-
This question is used to populate the end user’s avatar. An end user may wonder why this question is being asked. It is a good practice to include a Learn More to explain.
-
In the Question Text section of the Question Design Window, find the field labeled “Learn More prompt”. In that space type, “Why are you asking this question?”
-
In the “Help” field (this is the reply the guide avatar gives) type, “This question is used to populate the avatar that will represent you through the rest of this A2J Guided Interview.”
-
Click close.
-
-
Open the question called “New page” and change the Step to 1. Change the name to 3-Address.
-
In the text box type, “What is your address?”
-
Scroll down to the Fields section. Select 4 from the “Number of fields.” The Field information will now appear for 4 fields. Here is where we are going to collect the end user’s address.
-
In the first field, change the label to “Street” (this will appear in front of the field where the end user will type in their street address). The variable should be [Address street TE]
-
*Note: When you start typing a variable, A2J Author will offer up suggestions from your list of variables that match the letters you have typed.
-
-
In the second field, change the label to “City” and the variable should be [Address city TE]
-
In the third field, change the type to “Text (Pick from list)”, change the label to “State” and the variable should be [Address state MC].
-
We are now going to add in a list of U.S. states in alphabetical order. Instead of making you type that list in, download the list in xml format here. Save it some place on your computer.
-
Click the “Upload” button next to “External list.” Navigate to where you saved that U.S. states xml list and click open.
-
-
In the fourth field, change the type to “Number ZIP code,” change the label to Zip code, and the variable should be [Address zipcode TE]. Close the Question Design window for this question.
-
-
Open the question called “New page 2” and change the Step to 1. Change the name to 4-Phone number.
-
In the notes section write: This question also sets the logic for the variable that tracks today’s date. It uses a function called TODAY to insert the date the end user runs through the interview automatically.
-
On this question, we will use advanced logic to set the variable [Today date DA] as well as collect the value for the variable [Phone number TE].
-
-
In the text box type: “What is your phone number?”
-
Create 1 field in the Fields section. The type should be “Number Phone,” the label “Phone number,” and the variable is [Phone number TE].
-
Scroll down to the Advanced Logic section. In the After box type:
-
-
SET [Today date DA] TO TODAY
-
Open the question called “New page 2 2” and change the Step to 2. Change the name to 1-Marital Status.
-
In the text box type, “What is your marital status?”
-
Scroll down to fields and create 4.
-
In the first one, make the type “Radio Button.” The label should be “Married,” the variable is [Marital status MC], and the default value is Married.
-
In the second field, the type is “Radio Button,” the label is “Single,” the variable is [Marital status MC], and the default value is Single.
-
In the third one, the type is “Radio Button,” the label is “Divorced,” the variable is [Marital status MC], and the default value is Divorced.
-
In the fourth one, the type is “Radio Button,” the label is “Widowed,” the variable is [Marital status MC], and the default value is Widowed. Click close.
-
-
Open the question called “New page 2 2 2” and change the Step to 2. Change the name to 2- Have children?
-
In the text box type, “Do you have children?”
-
Scroll down to the Buttons section. Select 2 buttons from the drop down list.
-
The first button should have the label “Yes,” the variable is [Have children TF] and the default value is “true” (no quotes when you type it into A2J Author)
-
*Leave the destination question to [no where] for now. We’ll set that later on.
-
-
The second button should have the label “No,” the variable is [Have children TF] and the default value is “false” (no quotes when you type it into A2J Author)
-
-
Close this question.
-
-
Open the question called “New page 2 2 2 2” and change the Step to 2. Change the name to 3-How many children?
-
In the text box type, “How many children do you have?”
-
Scroll how to the Fields section. Create 1 field. The type should be Number (Pick from list), the label is “Number of children,” the variable is [Number of children NU], the Min value is 1, and the Max value is 4.
-
*Note: We are limiting the maximum number the end user can input arbitrarily. Your actual form, court policy, or legal aid organizational guidelines would dictate the scope generally.
-
-
-
Open the question called “New page 2 2 2 2 2” and change the Step to 4. Change the name to 1-The End.
-
In the text box type, “Congratulations! You have finished your A2J Guided Interview. Click Get My Document to print your completed form.”
-
*Note: In your real document assembly project, you may wish to include instructions on how the end user will get their document. This will vary based on which server your A2J Guided Interview is hosted.
-
-
In the Buttons section, change the button label to “Get My Document”. Change the Destination question by clicking on the blue button next to “Destination.” Change it to [Assemble-Generate PDF]. Click Change. Click Close.
-
-
Open the question called “1-Question 1” and change the Step to 3. Change the name to “1-Purpose of form.”
-
Type in the text box, “Why are you filling out this form?”
-
Create 1 field. The type is Text (Long), delete the word “label”, and the variable to use is Purpose of form TE.
-
Edit the button label to “Continue” and set the Destination to 1-The End. Click Change. Click Close.
-
-
Open the question called “New page 2 2 2 2 2 2” and change the Step to 2. Change the name to 4-Do they all live with you?.
-
Type in the text box, “Do all of your children live with you?”
-
Create 2 buttons in the Buttons section.
-
Button 1: Label - Yes; Variable name: All live with you TF; Default value: true
-
Button 2: Label - No; Variable name: All live with you TF; Default value: false
-
-
Click Close.
-
-
Now that we have created all of our questions, we need to connect them to one another.
-
Open up each question and go to the Buttons section. The questions should be connected through the Destination option as follows. Change any that are not connected this way.
-
1-Introduction to 1-Name
-
1-Name to 2-Avatar
-
2-Avatar to 3-Address
-
3-Address to 4-Phone number
-
4-Phone number to 1-Marital Status
-
1-Marital Status to 2-Have children?
-
2-Have children (Yes option) to 3-How many children?
-
2-Have children (No option) to 1-Purpose of form
-
3-How many children? to 4-Do they all live with you?
-
4-Do they all live with you to 1-Purpose of form (both yes and no buttons)
-
1-Purpose of form to 1-The End
-
1-The End to [Assemble-Generate PDF]
-
-
Now that we have connected everything, we need to test our complete A2J Guided Interview.
-
Open 1-Introduction. Click Preview and open the Debug Panel
-
Go through your A2J Guided Interview and make sure that all of your variables populate and that your advanced logic works properly.
-
When you get to the end, don’t click the “Get Document” button. When you’re in Preview Mode, A2J Templates don’t assemble. Go to the Variables Box and click “Save”. This will download your answer file.
-
Go to the Template Tab and click “Test Assemble” button . It’ll prompt you to load the answer file that you saved in the step above. Once it’s loaded, click “Get PDF”.
Congratulations! You’ve successfully created your A2J Guided Interview and A2J DAT PDF Template. It should look like this when Test Assembled: