Copy a Form to the same project and for different projects using Automation and API

As an extra option of workaround to the feature request "Include Forms when cloning an issue", this guide is designed to assist users in using the Forms API to automatically duplicate a form between issues.

Steps to Follow:

  • Set Up an Automation Rule:
    • Create an API token for the web request process. This requires encoding your credentials and API token with base64. For detailed steps, refer to the documentation:
    • Use the REST API feature "Copy forms" in a POST request. Example:
      • Copy a form during an issue status transition to a linked issue:

        The request method will be POST:

        POST https://api.atlassian.com/jira/forms/cloud/{cloudId}/issue/{sourceIssueIdOrKey}/form/copy/{targetIssueIdOrKey}

        - Use your Cloud ID (not Org ID). Find it in the URL when accessing your Atlassian admin page, e.g., https://<instance>.atlassian.net/admin/jira-service-desk/portal-only-customers.

        - Use the issue ID or Key dynamically with smart values like {{issue.id}} or {{issue.key}}.

        - Access the formId using smart values like {{issue.forms.formTemplateID}}. For instance, if the formTemplateID is "cf638d8b-0498-4b80-8fb1-f547dc769421", use {{issue.forms.cf638d8b-0498-4b80-8fb1-f547dc769421}} to get the formId.

        - Add the formId dynamically with:

        {{issue.forms.formTemplateID}}

        - Specify the targetIssueIdOrKey for the issue you want to copy to. Use the following smart value to get the linked issue's ID:

        {{issue.issuelinks.inwardIssue.key}}

        - Your automation rule setup should resemble the image below:

        Screenshot 2025-01-06 at 17.40.51.png

Warning Note: By enabling "Delay execution of...", you ensure the rule waits for the web request to complete before proceeding with further actions, which is vital when the request outcome affects subsequent automation steps.

Watch the process in action in the video below:

For Different Projects: The process is similar, with a few additional details:

  1. Ensure your automation rule has a global scope that includes all projects involved (where forms will be copied and sent).
  2. Optional: Implement a filter to identify the linked issue containing the form to be copied, which may vary based on your use case. For example, an IF condition to check if "issues blocked by" was used.

Watch the cross-project process in the video below:

12 comments

Ralph Gerald Varon
Contributor
August 16, 2023

Is there a smart value

{{issue.properties."proforma.forms".forms.uuid}}

if multiple forms are attached, it will return multiple uuid as well. how can we get the UUID of a specific attached form? 

Like # people like this
Mogens Hald Kristensen
Contributor
August 29, 2023

The target issue id  smartvalue should be {{issue.issuelinks.outwardIssue}}

Like Bruno Altenhofen likes this
Bruno Altenhofen
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 20, 2023

Hello @Ralph Gerald Varon

Allow me to share with you this article that explains how to manipulate multiple forms separately:

Thanks!

Mauricio Heberle
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 26, 2023

It works for multiple projects, Ive just tested here. Thanks!

Like Bruno Altenhofen likes this
Bruno Altenhofen
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 29, 2023

Hi @Mauricio Heberle

Thanks for the feedback!

Yes!!! I've updated this info in the article!! :D

Cheers!!

Like Mauricio Heberle likes this
Mauricio Heberle
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 29, 2023

@Bruno Altenhofen You're welcome! If this could be added to the component "Add Form", would be great. Also, I noticed that for some automations, it is necessary to refetch issue data before sending the web request. 

Jimmy Karlsson December 21, 2023

Hi,

Is there any way to copy all of the forms from one issue to another? I´m getting this to work the way you have set it up, and when I have several forms the smart value {{issue.properties."proforma.forms".forms.uuid}} returns all the id's as this;

5b44c132-802b-48b0-a5cb-60b864360d37, 226dac84-d5d5-4355-8080-1f4cc550148c, 2d4b93e8-112a-4faf-98f8-abe9c11ee329

This does not work in the "Custom data" field tho, I´m getting this error:

{"errors":[{"status":400,"code":"BAD_REQUEST","title":"There was an issue with your request","detail":"1 error found in JSON: (1) /ids(0) should be a UUID"}]}

Nia Yanes Barreto
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 29, 2024

Would this solution only work with ProForma forms? If so, is there a workaround for Jira built-in forms?

Mauricio Heberle
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 29, 2024

@Nia Yanes Barreto Its for forms created in "Forms" module within Jira Service Management projects.

Lukasz
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 12, 2024

Hello @Bruno Altenhofen 

Is it possible to use this workaround to copy a form from one project to another project when both of them are Team-managed (next-gen) projects? In that case, are there any special steps to follow?

Thanks for your response!

Like Bruno Altenhofen likes this
Fye
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 8, 2024

The POST method endpoint in the workaround contains a duplicate "jira" string. It should only be one as documented in the GET Forms REST API doco e.g.:

https://api.atlassian.com/jira/forms/cloud/{cloudId}/issue/{sourceIssueIdOrKey}/form/copy/{targetIssueIdOrKey}

@Bruno Altenhofen Can you correct the endpoint URL, please? 

Like Bruno Altenhofen likes this
Bruno Altenhofen
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 9, 2024

Hey guys!

@Lukasz - Yes, you can certainly utilize this approach in a Team-managed (next-gen) project. Additionally, you have the flexibility to copy forms between the Team and Company-managed projects as well.

 

@Fye - Updated! Thanks!! :D

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events