Work has already started on the new Forms API functionality and we now have some experimental APIs available for use. So now Marketplace Partners can already integrate forms into their products.
For more information, please refer to the features below:
As a workaround to the feature request "Forms Automation: Automation to control the forms visibility", this article is meant to help users who want to use the new experimental features of the Forms API to automatically change the form visibility between internal and external.
To change the form visibility to external when an issue is transitioned:- The web method will be a PUT:
PUT /jira/forms/cloud/{cloudId}/issue/{issueIdOrKey}/form/{formId}/action/external
- The cloudId will be your Cloud ID and not your Org ID. The easy way to get the cloud id is to go to https://<instance>.atlassian.net/admin/jira-service-desk/portal-only-customers. You will get the Cloud id in the URL (e.g.: https://admin.atlassian.com/s/<cloud_id>/jira-service-desk/portal-only-customers)
- The issue ID or issue Key that you are using. To add the issueId or issueKey dynamically, you can use the smart value {{issue.id}} or {{issue.key}}
- The formId will be in the universally unique identifier "uuid" format. To get it you can use the Forms properties structure below:
https://<yourCloudURL>.atlassian.net/rest/api/2/issue/<issueId>/properties/proforma.forms
- To add the formId dynamically, you can use the smart value below:
{{issue.properties."proforma.forms".forms.uuid}}
- The automation rule will be as shown in the screenshot below:
- The web method will be a PUT:
PUT /jira/forms/cloud/{cloudId}/issue/{issueIdOrKey}/form/{formId}/action/internal
Note: To call experimental methods the "X-ExperimentalApi" and "opt-in" header must be provided on the web request headers.
X-ExperimentalApi" and "opt-in"
This workaround will work as shown in the screen recording below:
https://www.youtube.com/watch?v=IThVV-3nMgg
Very detailed and well written step-by-step tutorial, @Bruno Altenhofen Thanks for sharing! Recently I created an automation very similar to the one you have suggested, though with a twist.
I wanted to select and attach a form to a service ticket depending on a field selected by a customer. As the number of customers and field cases is large, I used the action "Create a lookup table" so that the table can hold the form template IDs (up to 20 key-value pairs). The custom field values are the keys, whereas the template IDs are the values in our lookup table.
When the custom field value matches a form template ID, the rule executes two "Send web request" actions one after the other:
1. attach a form to the Jira issue: POST request https://api.atlassian.com/jira/forms/cloud/<cloud ID>/issue/{{issue.key}}/form
{"formTemplate": {"id": "{{<uuid of the form>}}"}}
One needs to select the option in the action "Delay execution of subsequent rule actions until we've received a response for this web request" so that the next action can process the form instance ID (not the UUID of the form template).
2. change the visibility of the newly attached form: PUT request https://api.atlassian.com/jira/forms/cloud/<cloud ID>/issue/{{issue.key}}/form/{{webResponse.body.id}}/action/external
Without the second action, the form's visibility is set to internal by default, thus not visible to the customer in the portal.
Maybe the Forms API team can consider adding parameters to the "Add form" method by allowing setting the visibility in a single call. @Simon Herd
(i) <value> - without the brackets <, >
(i) By the way, one doesn't need the header Accept:application/json for a successful request.
Hey @Kalin U
Thanks for sharing your feedback and bringing your use case to us!
Apologies for my delay in responding to you (I was a little off in the Atlassian Community these last few days). So this is a great idea and thanks for sharing it with us. We’re always keen to seek feedback on the Forms API functionality and how it meets our client's needs and/or how it could be modified to meet our customer's needs.
I'll share your example internally with the Forms dev team.
Thanks!
Is it possible to get a specific UUID of the form, if there are already multiple forms attached?What if I only want one form to be internal/external
Hey @Ralph Gerald Varon
Is it possible to get a specific UUID of the form, if there are already multiple forms attached?
Yes, using the smart values below:
{{webResponse.body}} - get the body{{webResponse.body.id}} - get the ids{{webResponse.body.id.get(0)}} - get the first id{{webResponse.body.id.get(1)}} - get the second id{{webResponse.body.id.get(2)}} - get the third id
For more information, allow me to share with you this article that explains how to manipulate multiple forms separately:
Amazing! thank you!
It looks like you're new here. Sign in or register to get started.