Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Using Automation I need to attach a form based off custom field value

Beth Starr October 27, 2023

Using Automation for Jira:

I need to be able to attach a form matching a value in a custom field. The custom field may have 1 or more values and may require 1 or more forms to be attached to the issue.

Example:

CustomField A value - X, Y, Z

I need to look up the matching forms (X,Y,Z) and attach them to the ticket.

Lookup Tables will not work due to there being several hundred forms and the lookup tables is limited to 25, plus this would be a nightmare to maintain due to the volume of forms.

If/Else statements would be too taxing on the system and a nightmare to maintain.

I am looking for a simpler approach to look up the matching forms based on the values selected in the custom field and attach them to the issue. 

Any ideas?

 

2 answers

0 votes
Per Lofgren March 21, 2024

Did this get solved? If so, how? 
I am in a similar situation where I need to attach form(s) based on a field value as well. 

Cheers
Per

kiestone
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 3, 2024

Per, Here is my solution to automatically attach ~n~ forms to an issue.

First you need to find the form Template ID for the forms you want to attach using this
https://<yourAtlassian>.atlassian.net/rest/api/2/issue/<<yourIssueKey>/properties/proforma.forms

I have the forms/Templates stored in an Asset ObjectType.

When a ticket is created, in my automation, I look for the forms that are required for that request.

{{#Debug}}"ObjectType" ="Forms List" {{Query}} and Key in ({{issue.Request Structure.first.Required Forms}}){{/}}   -- This is rather custom to my setup but this query returns a list of the forms for that request type

For each item in the list, I do the following:

Use the "Add form by Template ID" API
https://api.atlassian.com/jira/forms/cloud/<YourCloudID>/issue/{{Key}}/form

using this custom data where the {{object.formTemplateID}} is the ID of the form.

{{#Debug}}{
"formTemplate": {
"id": "{{object.formTemplateID}}"
}
}{{/}}

Hope this helps

Kim

Like Per Lofgren likes this
0 votes
Jehan Bhathena
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 28, 2023

HI @Beth Starr ,

You can try out the below approach using the FORMS api (https://community.atlassian.com/t5/Jira-articles/Add-a-Form-using-Automation-and-API/ba-p/2385407) :

NOTE: this is in theory, I haven't had the chance to test this out myself, but I believe this should work if your field name and form names match

If in case your form names and field names don't match then the lookup tables or If/Else loops would be the only way ahead. And given that you have more than 100 forms this will create more than 2 automation rules since the rules are limited to a lesser number of actions/conditions.

PS: Lookup tables seem to accept up to 200 values as per the message displayed in my instance
image.png

 

Hope this helps.

Please do post your solution here if you find any other alternatives too, since this use case sounds quite interesting.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events