Jira Cloud has added a great deal of flexibility and usability in recent years with the addition of Forms and Assets. Since then, those features have enjoyed continued integration into the Cloud platform, including dedicated Automation Components. However, even with these improvements, getting from Point A to Point B is not always straightforward. This post will outline how to use Automation to create an Asset from data submitted using a Form.
Form and Asset configuration
It is worth mentioning that the questions on the Form do not have to be a 1:1 representation of the Attribute values used to create the Asset. Form values can be modified or ignored entirely, and attribute values can be provided statically within the Automation Rule. A bit of planning is still in order, though.
Examples:
- if an Attribute uses a select list, ensure that all options presented on the Form are valid during Asset creation
- ensure any required Attribute values are accounted for in the Automation Rule in order to avoid errors
While configuring and testing the Rule, it can be helpful to build one step at a time and use the Log Action component to check values.
Capturing Form Data in Automation
The Web Request component is used multiple times to capture the data provided on the Form using the Forms REST API.
Requirements:
- Finding your Cloud ID
- In my testing, I had to enter the Cloud ID directly in the Web Request URL.
- Access Token
Retrieving the Form ID
The Get Form Index resource provides details regarding the Forms attached to the provided Issue.
Note: This example assumes that only one Form is attached to the Issue during this operation. If multiple Forms are attached, it would be necessary to iterate over the Forms data to identify the desired ID value.
Retrieving the Form answers
The Get Form Simplified Answers resource provides a user-friendly means for accessing the Form data. Storing the answers in a variable clarifies the following steps of the process.
Using a lookup table
If there is a large number of answers to process, consider using the Create Lookup Table component to provide additional clarity going forward. This allows you to define Keys for each answer. Individual Values can be captured by using a smart value to iterate over the form Data variable created in the last step.
- Example - this smart value would capture the answer provided to a Form Field named "Training Event Name"
-
{{#webResponse.body}}{{if(equals(label,"Training Event Name"), answer)}}{{/}}
-
- After creating the Lookup Table, defined values can be accessed using the defined Key.
- In this example, "values" is the name of the Lookup Table.
-
{{values.get("eventName")}}
Creating the object
Finally, everything is ready for the Create Object Automation action. Unfortunately, the Create Object action does not have a dedicated page in the Atlassian documentation. However, it can be found by searching for "create object". Select the appropriate Asset Schema, Object Type, and Attributes from the dropdowns. In this screenshot, you can see why creating the Lookup Table makes this part of the process easier to read.
Conclusion
While this is a simple example, it provides a solid foundation that can be built upon to support the creation of Assets with multiple Attributes of various types. Be sure to use the Log Action to check values and their formats.
Interested in learning more about how we help organizations? Check out our new case study: {{cta('172673257574')}}
Sign up to receive more great content
Learn more about Atlassian and how Isos can help by signing up to receive our latest blogs, eBooks, whitepapers and more.