Action - 📅 Update project end date from last work item due date

Action - 📅 Update project end date from last work item due date

This flow keeps your project's End date up to date: when a work item's due date changes and it is later than the project's End date, the flow updates the End date in Projectrak.

How this flow works

  • The flow only extends the End date, it never shortens it. If the work item with the latest due date is moved to an earlier date, the project End date stays as it is, so update it manually if needed.

  • It also works with other date fields, from Projectrak or from Jira. To use another Projectrak date field, enter its ID instead of the End date ID in steps 3 and 4. To use another Jira date field, choose it in the trigger and replace {{issue.duedate}} with its smart value (for example, {{issue.customfield_10015}}) in the {{smart values}} condition and in the last Send web request step. Use a date field, not a date-time field.

Before you start

Ask your Jira admin. Copy this message, fill in the parts in [brackets] and send it to your Jira admin: Hi! I use Projectrak and I'd like our project end dates to update automatically when work item dates change. Jira spaces that need the flow: [Space name 1] [Space name 2] Projectrak provides a ready-made Automation flow that a Jira administrator can import in a few minutes. Here is the flow and how to set it up. The flow is imported disabled. To set it up you need: A Projectrak API key. This is how to create one. The Projectrak date field to update: [Field name, e.g. End date]. ID: [Field ID] / How to find the field ID in the Projectrak Field manager The work item date field that sets it: [Field name, e.g. Due date] Could you take a look? Thanks! Are you a project administrator? You can't import flows, but you can create this flow in your own project: go to Project settings › Automation, create a new flow and follow the steps in Build the flow manually below.

Import the ready-made flow

Download the flow template:

This flow is a template. It is imported disabled and won't work until you enter your own data in the steps below.

There are 4 steps to get the flow working: import it, then enter your own data in 3 places.

Step 1. Import the flow

  1. Go to Jira settings › System › Global automation.

  2. Click the button with the ••• icon and select Import flows.

  3. Upload the JSON file.

  4. Leave Import flow owners unchecked, so you become the owner of the flow.

  5. Optional: use Select spaces to limit the flow to the projects that need it.

step1-import-flows.png

Step 2. Enter your Projectrak API key

  1. Open the first Send web request step (POST …/api-keys/jwt).

  2. In Custom data, replace YOUR_API_KEY_ID and YOUR_API_KEY with your own values. Keep the quotes.

Don't have them yet? How to create a Projectrak API key

step2-api-key.png

Step 3. Enter your End date field ID in the GET request

  1. Open the second Send web request step (GET …/fields/YOUR_END_DATE_FIELD_ID).

  2. At the end of the Web request URL, replace YOUR_END_DATE_FIELD_ID with the ID of your End date field.

You can find the ID in the Projectrak Field manager.

step3-field-id-get.png

Step 4. Enter your End date field ID in the POST request

  1. Open the last Send web request step (POST …/values/projects/{{issue.project.id}}).

  2. In Custom data, replace YOUR_END_DATE_FIELD_ID with the same ID. Don't add quotes: write "fieldId": 10, and not "fieldId": "10",.

step4-field-id-post.png

Save and enable the flow

Click Save after your changes, then turn the flow on with the Enabled toggle.

Flows that apply to all projects use more of your monthly Automation executions. Limit the flow's scope to the projects that need it.

Build the flow manually

Step 1. Configure trigger Create a new trigger → Field value changed Field to monitor for changes: Choose due date Change type: Any changes to the field value Step 2. Get the authorization token Add the steps “Get the Projectrak JWT” and then “Store the JWT in a variable“, described at this link: Important: If you don’t have already created a Projectrak API token , you have to do so as described in the first steps of the above link. If you have already got it, you can reuse it. Step 3. Get the field object Add component → New action → Send a web request For this example, our End date field from Projectrak has the id: 2870 :warning: Replace using your id Web request URL: https://profields-cloud.deiser.com/values/projects/{{issue.project.id}}/fields/2870 Headers: Content-Type: application/json Authorization: Bearer {{projectrakJwt}} → Defined in step 2 HTTP method: GET Web request body: Empty Check: Delay execution of subsequent flow actions until we've received a response for this web request Step 4. Store the field object in a variable Add component → New action → Create variable Variable name: projectEnddate Smart value: {{webResponse.body.value.value}} Step 5. Compare dates between the project and the current work item Add component → New condition → {{smart values}} condition (called “Advanced compare condition” in older versions of Automation) First value: {{issue.duedate}} Condition: greater than Second value: {{projectEnddate}} Step 6. Update the project End date with the work item due date Add component → New action → Send a web request For this example, our End date field from Projectrak has the id: 2870 :warning: Replace using your id Web request URL: https://profields-cloud.deiser.com/values/projects/{{issue.project.id}} Headers: Content-Type: application/json Authorization: Bearer {{projectrakJwt}} → :warning: Understand how to create a Projectrak authorization in Automation for Jira HTTP method: POST Web request body: Custom data Custom data [ { "fieldId": 2870, "value": "{{issue.duedate}}" } ] Check: Delay execution of subsequent flow actions until we've received a response for this web request