Associate a layout when a project field changes
Requisites
For the execution of this rule, there must be:
Layout that will be associated with the project.
A project field to change its value. In this case we are going to use the Category, a project field created by Jira.
Configure the rule trigger
Create a new trigger → Incoming webhook
Copy the autogenerated url for the incoming webhook.
Set the field “Execute this automation rule with“ with “No issues from the webhook“
Create a Projectrak outgoing webhook
In order to the rule will be executed when a project field changed we need to create a outgoing webhook pointing to the Automation Incoming webhook url.
Go to: Administration → Apps → Projectrak → Projectrak outgoing webhooks
Create a new webhook
Set the name of the webhook and the url with the previously copied url from the Automation incoming webhook and save.
Now you have linked Projectrak with Automation rule.
Now, when a Projectrak field value is edited in any project, the Automation rule will be triggered.
Configure the rule steps
You can see the information that will be sent to the rule every time a field is updated in a project here: https://deiser-apps.atlassian.net/wiki/spaces/PROJECTRAKCLOUD/pages/48824321
1. Getting the project id
Create an action: Create variable
Variable name: projectId
Smart value: {{webhookData.project.id}}
2. Get the new project category from the webhook data
Create an action: Create variable
Variable name: projectCategoryChanged
Smart value: {{#webhookData.fields}}{{#if(equals(name,"Category"))}}{{value.current}}{{/}}{{/}}
3. Set the layout id in a variable
Go to the administration table of layouts and get the id of the layout from the first column.
Create an action: Create variable
Variable name: layoutId
Smart value: <LAYOUT_ID>
4. If the rule should be executed continue
Create a condition: Advanced compare condition
First value: {{projectCategoryChanged}}
Condition: equals
Second value: <CATEGORY_NAME>
5. Get the Projectrak authorisation JWT
Add the steps explained here: How to create a Projectrak authorization in Automation for Jira
6. Associate the layout to the current project
Create an action: Send web request
Web request URL: https://profields-cloud.deiser.com/layouts/{{layoutId}}/projects/{{projectId}}
Headers:
Content-Type: application/json
Authorization: Bearer {{projectrakJwt}}
HTTP method: POST
Web request body: Empty
Check: Delay execution of subsequent rule actions until we've received a response for this web request