Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Step

Component

Details

1

When: Issue is transitioned

Example trigger when an issue is marked done to add the cost of the issue to the budget used.

From status: In Progress

To status: Done

2

Then: Send web request

Use the Crumbs API to find the customerId of the customer linked.

Web request: https://crumbs-prod.newverveconsulting.com/api/1/customerissueLink/{{webResponse.body.customerIds.firstissue.key}}

Header:

  • Name: Authorization

  • Value: Bearer <Crumbs API token>

HTTP method: GET

Web request body: Empty

Wait for response:

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

3

And: Create variable

Save the smart value customerId to be used in later steps.

Variable name: customerId

Smart value: {{webResponse.body.customerIds.first}}

4

And: Send web request

Use the Crumbs API to get the customer details.

Web request: https://crumbs-prod.newverveconsulting.com/api/1/customer/{{customerId}}

Header:

  • Name: Authorization

  • Value: Bearer <Crumbs API token>

HTTP method: GET

Web request body: Empty

Wait for response:

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

5

And: Create variable

Calculate the total and save it to a variable. This step is optional but makes it easier to explain.

Variable name: total

Smart value: {{#=}}{{issue.fields.<Cost issue field ID>|0}} + {{webResponse.body.fields.<Budget customer field ID>.asNumber|0}}{{/}}

The smart value is broken down into:

  • {{#=}} - The start of a maths expression.

  • {{issue.fields.<Cost custom field ID>|0}} - The Cost issue field value.

    • Replace <Cost custom field ID> with the ID of the custom field e.g. customfield_10001. This can be found using the GET /field Jira API.

    • |0 - will default the value to 0.

  • + Here we are adding the cost of the issue to the existing budget used.

  • {{webResponse.body.fields.<Budget customer field ID>.asNumber|0}} - The Budget Used customer field value.

    • Replace <Budget customer field ID> with the ID of the custom field e.g. cc659e96-cb91-4e81-a8fa-cdf222c2dcef. This can be found using the GET /field Crumbs API.

    • |0 - will default the value to 0.

  • {{/}} - The end of the maths expression.

6

And: Send web request

Use the Crumbs API to modify the customer details.

Web request: https://crumbs-prod.newverveconsulting.com/api/1/customer/{{customerId}}

Header:

  • Name: Authorization

  • Value: Bearer <Crumbs API token>

HTTP method: PUT

Web request body: Custom data

Custom data:

Code Block
{
    "<Budget customer field ID>": {{total}}
}
  • Replace <Budget customer field ID> with the ID of the custom field e.g. cc659e96-cb91-4e81-a8fa-cdf222c2dcef. This can be found using the GET /field Crumbs API.

Wait for response:

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

...