Sample Exercise: Quick and Easy Automation with A2J Author

Last updated November 2022

 Sample Exercise: Quick and Easy Automation with A2J Author

 

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.

  1. Log into your www.a2jauthor.org account. If you aren’t sure how to create an account, check out this resource.

  2. Once logged in, go to the “Author” tab and click it. Home page.png

 

  1. Then click “Run A2J Author”.

  2. 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, check out our Authoring Guide.

  3. Go to the About tab and change the title of your interview to Sample Exercise: Quick and Easy Automation. You can select any guide avatar options to customize the Guide avatar. You should also click over to the Authors tab inside the About tab in order to add your information as the author of this interview.

  4. 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.

  5. 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:

  6. Name your template. In the “Untitled Template” field in the left editing panel, delete “Untitled Template” and type in “Quick and Easy 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.

  7. 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.

  8. 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:

  9. 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 below gif.

  1. 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.   

  2. 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 are for text variables to ensure that the end user’s information populates the field appropriately. If we need them, it will be noted in the variable creation section by the specific variable.   

    1. Create a text type variable with the name: Name full TE (see the gif above)

  3. Create fields and assign variables for the following: (variable type is in parenthesis after the name of the variable. Don’t include the type in the name of the variable)

    1. Today plus 7 days DA (date variable)

    2. For the “I want to learn how to automate...” question, create fields on all three lines. There are a couple keyboard shortcuts built into the A2J DAT PDF Templates. If you create one field 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 field. Then click on that field and hit Ctrl + D (control key and the "D" key) to duplicate it. You can then move it to cover another area. This can be repeated with any field.

      1. For this questions, all three fields will have the same variable which is Purpose of automating TE (text variable). Add that variable to all three fields. 

      2. 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 2 lines.

      3. Hold the Ctrl key down and select all three 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.

      4. 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 Why I want to automate in the Addendum label field. This tells A2J Author to automatically create an addendum and use the label you provided for all overflow text.

 

  1. State MC (multiple choice)

    1. Under field type, make sure the circle for "Pass multiple choice value" is filled in. This will pass the 2 letter abbreviation for the state. 

  2. Role in organization MC (multiple choice)

    1. This multiple choice variable will cover the 5 boxes for role in organizations. When creating the 5 boxes, remember the Ctrl+ D shortcut mentioned above. The same variable will be used for all five. Select “Draw a checkmark if the variable matches” for all 5. The difference will be what you insert in the “Multiple choice value” field. (Note: spacing and capitalization matters here. When you use this variable in a question, your default values need to match exactly with what you type in here.)

      • Legal professional

      • IT professional

      • Administrator

      • Law student

      • Other

  3. There is a blank space next to “Other” to allow an end user to type in their role, if it wasn’t specified in the list of options. So create a text variable there called Other role TE.

    1. 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’s role in their organization 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 an addendum label called "Role in organization". 

  4. Phone number TE (text variable)

    1. This is a text variable, even though it contains numbers because number variables should only be used when you plan to do calculations with the numbers.

  5. Zipcode TE (text variable)

    1. This is a text variable, even though it contains numbers because number variables should only be used when you plan to do calculations with the numbers.

  6. Favorite number NU (number variable)

  7. Will automate again TF (true/false variable)

    1. This true/false variable will be used for both “Will” and “Will not” options for the “Will you automate again” question. When you insert the “Will Not” option, just check the “If the variable is false, draw the checkmark” option.

You’ve completed the automation of the A2J PDF Template. Remember to hit 'Save' before moving on to the interview portion. It should look like this now:

A2J Guided Interview

 

We are now going to create an A2J Guided Interview that will be paired with your A2J Template. Go back to the Pages tab (after saving your template). 

 

  1. 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.

    1. Click the New Page button New page button.pngat the top of the screen 7 times. Your screen should look like this:.

  1. Go to the Steps Tab. There are 4 steps there by default. We can use the default steps for this exercise, but we need to change their names as follows:

    1. Step 0 to Introduction

    2. Step 1 to Personal Information

    3. Step 2 to Job Information

    4. Step 3 to The End

  2. Go back to the Pages tab and Double click on 1-Introduction under Step 0.

    1. Question text: Welcome to the A2J Guided Interview intended to teach authors how to quickly and easily automate a document in A2J Author. This interview should take you about 5 minutes to complete as an end user. At the end, you’ll be able to create a fun document showing off the automation skills of the author! Click “Continue” to get started.

    2. We’ll connect all the questions to each other at the end, so you can close the question once you enter the above text.

  3. Double click on 2-Name. Move it to Step 1 and rename it 1-Name. The question text and variable fields can stay as they are. Scroll down to the Advanced Logic section. We’re going to script a quick and easy logic statement to combine the user’s first, middle, and last name. Type this into the AFTER logic box exactly as shown here:

Note - this is purposefully an image and not the plain text to copy and paste. Copy and paste notoriously creates problems in the Advanced Logic section because underlying formatting can be mistakenly copied in and cause issues with the Javascript.  

  1. Double click on 3-Avatar. This question asks the end user to select an avatar that represents them on the pathway to the courthouse. We can leave the question text as it is in the default, but change the Step to Step 1 and change the name to 2-Avatar.

  2. Click on 1-Question 1 in Step 1. Rename it 3-Reason for learning A2J Author.

    1. Question text: Why did you want to learn how to automate an A2J Guided Interview?

    2. Create 1 field

      1. Type: Text (Long)

      2. Delete the “Label” because the question is clear enough without additional labeling.

      3. Variable: Purpose of automating TE

      4. Change the button label to Continue

  3. Double click on any new page you created. Change the Step to Step 1. Change the name to 4-State.

    1. Question text: What state do you live in?

    2. Create 1 field

      1. Type: Text (Pick from list)

      2. Delete the “Label”

      3. Variable: State MC

      4. 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. This list will display the full state name to the end user, but save the 2 digit postal code in the answer file.

      5. Click the “Upload” button next to “External list.” Navigate to where you saved that U.S. states xml list and click open.

      6. (If you’re using this Sample Exercise is another country besides the United States and create a similar XML list for your states/provinces/territories, we’d love to include it on our website. Please email it to our A2J Author Project Manager Jessica Frank at Jessica@cali.org)

      7. Close this page. 

  4. Double click on any new page you created. Change the Step to Step 1. Rename it 5-Favorite number

    1. Question text: What is your favorite number from the list provided?

    2. Create 1 field.

      1. Type: Number (Pick from list)

      2. Delete the “Label”

      3. Variable: Favorite number NU

      4. Min value: 0

      5. Max value: 125 (The min and max values will create the drop down list for the end user to select from.)

      6. Close this page. 

  5. Double click on any new page you created. Change the Step to Step 2. Rename it 1-Role in organization.

    1. Question text: What is your role in your organization?

    2. Create 5 fields.

      1. Field 1 - type: Radio button; Label: Legal professional; Variable: Role in organization MC; default value: Legal professional

      2. Field 2 - type: Radio button; Label: IT professional; Variable: Role in organization MC; default value: IT professional

      3. Field 3 - type: Radio button; Label: Administrator; Variable: Role in organization MC; default value: Administrator

      4. Field 4 - type: Radio button; Label: Law student; Variable: Role in organization MC; default value: Law student

      5. Field 5 - type: Radio button; Label: Other; Variable: Role in organization MC; default value: Other

  6. We’re going to script a logic condition that tests if the end user selected “Other”. If they did, they will be branched to a follow up question asking them to type in their job title or role in the organization. First we have to create the follow up question. Close the Role in organization page. Double click on any new page. Move it to Step 2. Rename it 2-Other explanation.

    1. Question text: You selected “Other" as your role in your organization. Please describe your role or give your job title. If you made a mistake, click “Go Back” to go back to the previous question and select another option.

    2. Create 1 field.

      1. Type: Text

      2. Label: Role or job title

      3. Variable: Other role TE

    3. Create two buttons.

      1. Button 1- Label: Go Back; Destination: [Back to prior question]

      2. Button 2 - Label: Continue; Destination to be set later.

    4. Close this page. Go back to 1-Role in organization. Double click to open it. Scroll down to the Advanced Logic section. In the AFTER logic box, type the following:

  1. Close the Role in organization page. Double click on any new page. Move it to Step 2. Rename it 3-Office phone and zip code.

    1. Question text: What is your office phone number? In what zip code is your office located?

    2. Create 2 fields.

      1. Field 1- type: Number Phone; Label: Phone number; Variable: Phone number TE

      2. Field 2 - type: Number Zip Code; Label: Zip; Variable: Zipcode TE

    3. On this question, we’re also going to set the logic that will calculate today’s date and add 7 days to it. Scroll down to the Advanced Logic section. In the AFTER logic box, type the following:

This logic statement tells A2J Author to take today’s date (whatever date the end user runs the interview), add 7 days to it, then convert it back to a date, and set that new date as the value for the variable [Today plus 7 days DA]

  1. Close the current page. Double click on a new page. Move it to Step 3 and rename it 1-Will you automate again?

    1. Question text: After this Sample Exercise, will you start working on an actual automation project of your own?

    2. Create two buttons.

      1. Button 1 - Label: I will; Variable Name: Will automate again TF; Default value: true

      2. Button 2- Label: I will not; Variable name: Will automate again TF; Default value: false

  2. Close the current page. Double click on the final new page. Move it to Step 3 and rename it 2-The End.

    1. Question text: Congratulations! You’ve completed this A2J Guided Interview. To generate your document, click “Get My Document”!

    2. 1 button with a label of “Get My Document” and a destination of [Assemble - Generate PDF Document]

  3. 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 connect this way.

    1. 1-Introduction to 1-Name

    2. 1-Name to 2-Avatar

    3. 2-Avatar to 3-Reason for learning A2J Author

    4. 3-Reason for learning A2J Author to 4-State

    5. 4-State to 5-Favorite number

    6. 5-Favorite number to 1-Role in organization

    7. 1-Role in Organization to 3-Office phone and zipcode

      1. Remember, this will branch to 2-Other Explanation through the logic section if the user picks “Other”

    8. 2-Other explanation to 3-Office phone and zipcode

    9. 3-Office phone and zipcode to 1-Will you automate again?

    10. 1-Will you automate again to 2-The End

    11. 2-The End to [Assemble - Generate PDF Document]

    12. Your final map with all the pages connected should look like this: 

  4. Now that you’ve connected all the questions, we need to run through the A2J Guided Interview and test assemble the A2J Template.

    1. Open 1-Introduction. Click Preview Preview button.png and open the Debug Panel Variables_script button in preview.png.

    2. Go through your A2J Guided Interview and make sure that all of your variables populate and that your advanced logic works properly.

      1. 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 top of the Debug Panel and click “Save”. This will download your answer file. Click "Resume Edit" to leave Preview Mode. 

      2. Go to the Templates 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”.

      3. Your completed document should download automatically or prompt you to save it (depending on your browser's settings). 

  5. Congratulations! You’ve successfully created your A2J Guided Interview and A2J DAT PDF Template. It should look like this when Test Assembled:

 

Here are the completed A2J Guided Interview files. You can load them into your own authoring account (via the Interviews tab) to check them against the version you created using the instructions above. Don't unzip the interview files when you download them. Just upload the entire zipped file to your authoring account. 

  

Image: