Projectrak as action - Set work item field value when created, with a Projectrak field value

Projectrak as action - Set work item field value when created, with a Projectrak field value

To perform this use case, you need to have technical knowledge. If you need any kind of help, you can contact us through help@deiser.com

Here we describe the creation of an Automation rule to set the value of a work item field, when the work item of a certain type is created, getting the value from a Projectrak field.

 

0. Get the Projectrak field id

First of all, it's necessary to obtain the Projectrak field id from the Projectrak Field manager.

In the following example the id is: 42288, for the “Status” field.

1. Create an automation rule

Go to: Settings \ System \ Global Automation, and create a new rule.

You can also go there with a direct link, just replacing <your_instance> with yours:
https://<your_instance>.atlassian.net/jira/settings/automation

 

2. Configure trigger

Create a new trigger → Work itemcreated

3. Restrict to a work item type

Create a new condition to run the rule only for a work item type.
In this case for “Task” work item type.

 

4. Get the Projectrak authorization token

If you don’t have a “Projectrak API token” yet, follow the first steps (1 to 5) of the link below.
If you have already got it, you can reuse it.

Add to the rule the last 2 steps described in this link: How to create a Projectrak authorization in Automation for Jira

  • “6. Get the Projectrak JWT”

  • “7. Store the JWT in a variable“

 

5. Get the value of the project field for the work item project

Add component → New action → Send web request

For this example, our Status field from Projectrak has the id: 42288
Replace using your field id

  • Web request URL: https://profields-cloud.deiser.com/values/projects/{{issue.project.id}}/fields/42288

  • Headers:

    • Content-Type: application/json

    • Authorization: Bearer {{projectrakJwt}}  → defined in step 4

  • HTTP method: GET

  • Web request body: Empty

  • Check: Delay execution of subsequent rule actions until we've received a response for this web request

 

6. Store the project field value in a variable

Add component → New action → Create variable

  • Variable name: projectrakValue

  • Smart value:  {{webResponse.body.value.value.value}}

7. Change the work item field

Add component → New action → Edit work item

  • Choose fields to set: Stage

  • Stage:  {{projectrakValue}}

 

That’s all folks!