Using Advanced Form Fields to Trigger Automations in Jira

Recently, I encountered a requirement to automate tasks based on field data from advanced forms in Jira without relying on the "Forms submitted" trigger. While Atlassian provides documentation on accessing smart values for forms and form fields, I found it challenging to obtain the necessary form UUIDs. This article is meant to make it easier to obtain that information.

Step 1: Accessing Form Field Values

Let's assume you have a form with a multiselect field named "list." You can fetch the value from this field using the form ID in an A4J smart value like this:

 

{{issue.forms.6db457eb-ab0d-499b-9d83-f6b904345cfb.list.label}}

However, the documentation might be misleading regarding how to get the project form index. You need to find the {cloudID}, which is not your Jira cloud org ID but the cloud forms ID. To obtain this ID:

1) Open Developer Tools: In your browser, navigate to the direct link of your form and open the developer tools.

2) To find the Cloud ID: Go to the Network tab and look under request headers for existsWithWorkspaceType?cloudId=tr63sd96-f675-879a-998e-002h56ea25b2. The random characters after "cloudId=" are what you need.

download1.PNG

 

Step 2: Retrieving Form IDs via API

Once you have the cloud ID, you can use it in the API call to retrieve all forms within your project:

 

https://api.atlassian.com/jira/forms/cloud/{cloudId}/project/{projectIdOrKey}/form

This will return all advanced forms in the project along with their IDs. Find the ID for the form containing the field you want to access.


diagram2.png

Step 3: Fetching Field Values in Automation Rules


If you pass the form ID to a smart value like this:

{{issue.forms.f7142b07-d3a4-4522-a7e4-8799d526e0a6.payroll-salary}}

You can fetch the field value into your automation rules, provided you follow other prerequisites from the documentation.

If you are just looking to print the values, you can skip the next part.

Handling Radio Button or Multiselect Fields

Now, if the field value you are fetching is from radio button or multiselect field and want to iterate your automation action, you have to do some bit of text manipulations as the output from this field is not treated as list by A4J.

The smart value

{{issue.forms.<formid>.target-languages.label}}

will give you values in the following fomat which cannot be iterated over

[value1, value2]

You have to create a variable from the form smart value and then use that variable in the advanced branch of your rule.

Further information for this can be fetched from this community answer.

0 comments

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events