Using Forms with Gen 2
  • 22 Jun 2022
  • Dark
    Light
  • PDF

Using Forms with Gen 2

  • Dark
    Light
  • PDF

Article Summary

Using Forms to Collect Name Information

If you want to use different names each time you run the sample automation, manually adjusting the FirstName-Update and LastName-Update replace tasks would rebuild the automation each time, but it would also be highly inefficient. As a solution, it's far better to leave the automation "as is" and simply provide the name values when you run the automation. To accomplish this, you will need to use a JSON Form.

Likewise, running the automation from Automation Studio every time would not only be tedious but also require manual alterations that could unwittingly open the door to automation errors. To avoid this scenario, you will need to kick off the automation via JSON Form using the automations feature within Operations Manager.

Design the JSON Form

To design the JSON Form:

  1. Go to the Automation Studio application within IAP.
  2. Click the plus (+) sign in the toolbar on the top-left. The Create dialog will open.
  3. Select JSON Form from the dropdown list.
  4. Provide a name for the JSON Form. For example: "GenFacts".
  5. Provide a description (optional).
  6. Click the Create button. This will open the JSON Form Builder .
  7. Go the list of Form Elements on the right side.
  8. Drag and drop the Text Input element onto the canvas.
  9. Hover over the 3-dots menu icon and then click the cog icon to open the Configure dialog for Text Input.
  10. Label the text element "FirstName".
  11. Select "Yes" under the Required setting to make the "FirstName" label a required field.
  12. Click SAVE.
  13. Add another Text Input element and label it "LastName".
  14. Select "Yes" under the Required setting to make the "LastName" label a required field.
  15. Click Save.

Figure 1. Create JSON Form

01_GEN2-CreateWindow


Figure 2. JSON Form Builder

02-AutoStudio-FormBuilder-21.2

Build the Automation in Operations Manager

From the IAP home page:

  1. Select Operations Manager from the sidenav menu on the left. The main page displays.

  2. Click the plus (+) sign to create a new automation.

    Note: The "automation" terminology used here is somewhat of a misnomer. You won't actually be creating an automation as you did in Automation Studio. Instead you'll be providing access to an automation that's already built.

  3. Give your automation the name "GenerateFacts".

  4. Provide a brief description (optional).

  5. Click the Create button. The Automation canvas displays.

  6. Select the "EnlightenMe" workflow from the Workflow dropdown list.

  7. Click the +Trigger button to open the Create Trigger dialog.

  8. Input a name for the trigger and select the Manual Trigger type. The Form field displays.

  9. Select "GenFacts" from the forms dropdown list and input the desired name values.

  10. Click Save to retain your work.

Let's take a moment and do a checkpoint.

So far, you have created an Automation entry that will display a newly built "GenFacts" form. Next, you will need to send the form values to the "EnlightenMe" workflow, but keep in mind, the automation isn't expecting to receive input from a form. In this part of the process, you will need to update the workflow to use the entry values from the JSON Form instead of the "Replace" tasks -- FirstName-Update and LastName-Update.

Update the Workflow to Accept Form Inputs

The intent here is to consume the information from the "GenFacts" form instead of the hard-coded values contained in the "replace" tasks that update the first and last name.

  1. Add two new Query Tasks to the beginning of the automation.

  2. Double-click the first Query task to edit the properties.

  3. Change the Summary to "Form-FirstName".

  4. Change the Description to a short comment that will make sense in the canvas tooltip. For example: "Isolate FirstName from form".

    The description should be clear and give the user a hint as to the purpose of that specific task.

  5. Set the pass_on_null Reference Task variable to "False" (refer to the previously created "IsolateFact" query task as a reminder of how you did this earlier).

  6. Set the query Reference Task variable to "firstName", which is the name of the field in the JSON Form you created.

    For compliance purposes, the "FirstName" field label on the GenFacts form is automatically converted to camelCase, making it firstName instead.

Change the Object Variable

You will need to change the obj variable manually:

  1. Change the Reference Task to Job.
  2. For the Reference Variable, select custom.
  3. Manually enter the value formData (without quotes and case-senstive).
  4. Click SAVE.

The first Query task is now configured to understand that it will be obtaining content from a JSON form. Now let's move on to the second Query task.

  1. Configure the second Query task to be "Form-LastName".

    This query variable will search for lastName. Remember, the "LastName" field label is converted to camelCase on the GenFacts form.

  2. Set the pass_on_null variable to "False".

  3. For the obj variable, change the Reference Task to job.

  4. For the Reference Variable, select custom.

  5. Manually enter the value formData (without quotes and case-senstive).

    Figure 3. Set Variables

03_GEN2-FormData-variable

  1. Click SAVE.

You should now have a series of nine (9) workflow tasks on the canvas.

  1. START
  2. Form-FirstName (query)
  3. Form-LastName (query)
  4. OriginalURL
  5. FirstName-Update
  6. LastName-Update
  7. FetchFact
  8. IsolateFact (query)
  9. END

Figure 4: Complete Workflow

07_GEN2-CompleteWorkflow

Update the Replace Tasks

Next, you will need to update the replace tasks to consume and work with the form values collected in the Query tasks you added.

  1. Update the Firstname-Update task properties:
    • Set the newSubstr Reference task variable to the "Form-FirstName" task.
    • The Reference variable should automatically change to return_data.
  2. Click Save.
  3. Update the Lastname-Update task properties:
    • Set the newSubstr variable Reference task to the "Form-LastName" task.
    • The Reference variable should automatically change to return_data.
  4. Click Save.

Note: After updating all the tasks, you could try to manually run the automation, but it will likely result in an error. This is because the automation is now expecting input from a JSON form; however, up until now you have not directly indicated "what form" the automation should expect input values from. You'll recall that the form name was specified within the "GenerateFacts" entry in Automation Catalog.

Test Run the Workflow

To run the automation:

  1. Navigate to Operations Manager and find the automation you created from the Automations collection list.
  2. Click to open it.
  3. Click the Play icon at the top. The Run Automation modal opens.
  4. Select "Manual Trigger" fron the dropdown list.
  5. Provide FirstName and LastName values.
  6. Click Run. A success notification banner displays with a link to view the current job.
  7. Click the link to open the Job Details view within Operations Manager.
  8. Find the IsolateFact task in the job details list.
  9. Click the view icon to show the Outgoing task data.

You should observe that "Chuck Norris" has been replaced by whatever name values you entered in the Run Automation dialog from within Operations Manager.

Figure 5: Success Notification to View Job

05-SuccessViewJob-21.2

Summary Wrap-Up

Kudos, what great work you've done! You completed all the sections of this quick start tour from start to finish. Let's review all that you've accomplished on your journey:

  • Created an Automation that uses a custom JSON Form to obtain input that's passed to an automation.
  • Customized an automation to accept user input and utilize tasks to obtain data from a remote system.
  • Used additional task inputs that interacted with values presented by other tasks in the automation.
  • Viewed a completed job within Operations Manager and navigated to the Outgoing task data tab to view results.

After completing this guide, you should be well on your way to using all the the basic capabilities of your IAP instance. To expand your knowledge further, refer to the Itential Automation Platform User Guides provided on the docs.itential.com site for more detailed information.


Was this article helpful?

What's Next
Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.