...
Select the basic section
Choose your specific time: in this case every day at 06:00 AM
(image: 001_trigger.jpg)2.png)
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:
Code Block |
---|
echo -n YOUR_JIRA_USER:YOUR_JIRA_API_TOKEN | base64 |
Store the result (something like this):
(image: 002_jira_authentication.png)
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)
Code Block { "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
(image: 003_jira_projects.png)
3. Iterate each project
Add component → New branch → Advanced branching
Smart value: {{webResponse.body}}
Variable name: project
(image: 004_iterate_projects.png)
4. Get the field object
Add component → New action → Send a web request
Info |
---|
For this example, our End date field from Projectrak has the id: 287010
|
Web request URL: https://profields-cloud.deiser.com/values/projects/{{issue.project.id}}/fields/287010
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)
(image: 005_get_projectrak_enddate.png)
3. Store the field object in a variable
Add component → New action → Create variable
Variable name: projectEnddateendDateValue
Smart value: {{webResponse.body.value.value}}
...
(image: 006_create_enddate_variable.png)
4. Compare dates between the project and the current issuecurrent date and end-date of Projectrak.
Add component → New condition → Advanced compare condition
First value: {{issue.duedateendDateValue}}
Condition: grater less than
Second value: {{projectEnddate}}
...
5. Update issue field with project value(image: 007_compare_dates.png)
5. Get all issues from a project and unresolved
Add component → New action → Lookup issues
JQL: project={{project.id}} and resolution is empty
(image: 008_lookup_issues.png)
6. 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
(image: 009_compare_issues.png)
7. Update project status field
Add component → New action → Send a web request
Info |
---|
For this example, our End date status field from Projectrak has the id: 2870150166
|
Web request URL: https://profields-cloud.deiser.com/values/projects/{{issue.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
Code Block |
---|
[ { "fieldId": 2870, "value": "{{issue.duedate}}" 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)