1. Configure trigger
Create a new trigger → Scheduled
Select the basic section
Choose your specific time: in this case every day at 06:00 AM
2. Get the authorization token
Add the steps “Get the Projectrak JWT” and then “Store the JWT in a variable“, described at this link: https://deiser-apps.atlassian.net/wiki/spaces/PROJECTRAKCLOUD/pages/1641490/How+to+create+a+Projectrak+authorization+in+Automation+for+Jira?src=search
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.
3. Get all projects
Generate a base64 authentication for the Jira user
Generate a string in base64 with the text "<JIRA_USER>:<JIRA_API_TOKEN>"
Use the terminal:
echo -n YOUR_JIRA_USER:YOUR_JIRA_API_TOKEN | base64
Store the result (something like this):
Configure action
Add component → New action → Send web request
Web request URL: https://YOUR_INSTANCE.atlassian.net/rest/api/3/project
Headers:
Content-Type: application/json
Authorization: Basic c2VydmljZXRlYW2AZGVpc2VyLmNvbTpBTGN1bkwzNzQ1YTRBUFY3cXcwZkU3MkQ=-EXAMPLE (The Authentication in Base64)
HTTP method: POST
Web request body: Custom data
Custom data (ℹ️ Replace DUMMYAUTO for your project key)
{ "key": "DUMMYAUTO", "name": "Test dummy project autogenerated", "description": "Description for Test dummy project autogenerated", "leadAccountId": "{{issue.reporter.accountId}}", "url": "https://www.deiser.com", "assigneeType": "UNASSIGNED", "projectTemplateKey": "com.atlassian.jira-core-project-templates:jira-core-simplified-project-management" }
Check: Delay execution of subsequent rule actions until we've received a response for this web request
4. Iterate each project
Add component → New branch → Advanced branching
Smart value: {{webResponse.body}}
Variable name: project
5. Get the field object
Add component → New action → Send a web request
For this example, our End date field from Projectrak has the id: 10
Replace using your id
Web request URL: https://profields-cloud.deiser.com/values/projects/{{issue.project.id}}/fields/10
Headers:
Content-Type: application/json
Authorization: Bearer {{projectrakJwt}} → Understand how to create a Projectrak authorization in Automation for Jira
HTTP method: GET
Web request body: Empty
Check: Delay execution of subsequent rule actions until we've received a response for this web request
Check: Continue running the rule even if the request response is not successful (i.e. non-200 response)
6. Store the field object in a variable
Add component → New action → Create variable
Variable name: endDateValue
Smart value: {{webResponse.body.value.value}}
7. Compare dates between the current date and end-date of Projectrak.
Add component → New condition → Advanced compare condition
First value: {{endDateValue}}
Condition: less than
Second value: {{projectEnddate}}
8. Get all issues from a project and unresolved
Add component → New action → Lookup issues
JQL: project={{project.id}} and resolution is empty
9. Compare the numbers of issues in unresolved
Add component → New condition → Advanced compare condition
First value: {{lookupIssues.size}}
Condition: does not equal
Second value: 0
10. Update project status field
Add component → New action → Send a web request
For this example, our status field from Projectrak has the id: 150166
Replace using your id
Web request URL: https://profields-cloud.deiser.com/values/projects/{{project.id}}/fields/150166
Headers:
Content-Type: application/json
Authorization: Bearer {{projectrakJwt}} → Understand how to create a Projectrak authorization in Automation for Jira
HTTP method: POST
Web request body: Custom data
Custom data:
72176 is the item ID of status field from Projectrak
{ "value": 72176 }
Check: Delay execution of subsequent rule actions until we've received a response for this web request
Check: Continue running the rule even if the request response is not successful (i.e. non-200 response)