Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 9 Next »

Table of contents

You can use the Crumbs REST API to read and modify customer information. This page provides some common use cases of using Jira Automation.

Copy customer fields to an issue

Scenario:

  1. In Crumbs, create a customer and add information into a field.

  2. In Jira Automation, setup an automation to read the linked customer, lookup the customer and copy customer values to an issue.

  3. In Jira, link a customer to an issue.

Jira Automation Steps

Step

Component

Details

1

When: Field value changed

This is a trigger, and can be any moment in time you wish to copy the customer details over to the issue. Note that customers are linked after issue creation (which means that it must be triggered on issue update.

Fields to monitor for changes: Customer

Change type: Any changes to the field value

For: Edit issue

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/issueLink/{{issue.key}}

Headers:

  • 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: Send web request

Use the Crumbs API to get the customer details.

Web request: https://crumbs-prod.newverveconsulting.com/api/1/customer/{{webResponse.body.customerIds.first}}

Headers:

  • 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

4

And: Edit issue fields

Choose fields to copy customer to e.g.

Request participant: {{webResponse.body.fields.mainContact}}

If you are copying a custom field, you will need to know the fieldId. You can find this with GET /field. e.g. if the fieldId is 0a647c60-2513-40c2-a61a-2683cf19c1dd, to access the field use the following smart value:

{{webResponse.body.fields.0a647c60-2513-40c2-a61a-2683cf19c1dd}}.

Email main contact when customer is linked

Scenario:

  1. In Crumbs, create a customer with a main contact.

  2. In Jira Automation, setup an automation to read the linked customer, lookup a customer and email the main contact.

  3. In Jira, create an issue and link the customer.

Jira Automation Steps

Step

Component

Details

1

When: Field value changed

Fields to monitor for changes: Customer

Change type: Any changes to the field value

For: Edit issue

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/customer/{{webResponse.body.customerIds.first}}

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: Send web request

Use the Crumbs API to get the customer details.

Web request: https://crumbs-prod.newverveconsulting.com/api/1/customer/{{webResponse.body.customerIds.first}}

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

4

And: Send web request

Use the Jira API to convert the user accountId to an email address.

Web request: https://<site>.atlassian.net/rest/api/3/user?accountId={{webResponse.body.fields.mainContact}}

Header:

  • Name: Authorization

  • Value: Bearer <Jira 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: Send email

To: {{webResponse.body.emailAddress}}

Fill in the desired email details.

Link a customer automatically when an issue is created

Scenario:

  1. In Crumbs, create a customer.

  2. In Jira Automation, setup an automation to link a customer.

  3. In Jira, create an issue.

Jira Automation Steps

Step

Component

Details

1

When: Issue is created

2

Then: Send web request

Use the Crumbs API to link a customer to the issue.

Web request: https://crumbs-prod.newverveconsulting.com/api/1/issueLink/{{issue.key}}

Header:

  • Name: Authorization

  • Value: Bearer <Crumbs API token>

HTTP method: GET

Web request body: Custom Data

Custom data:

{
    "customerId": "<customerId>"
}

Use GET /customer to get the customerId.

Modify customer based on issue information

In this scenario, we want to track the total budget used by requests from the customer.

Scenario:

  1. In Crumbs, create a customer and a line field for ‘Budget Used’.

  2. In Jira administration, create a ‘Cost’ number field and add it to the screen.

  3. In Jira Automation, setup the automation to increment the budget by the issue cost.

  4. In Jira, populate the cost field for an issue and link a customer to the issue and trigger the automation, for example by transitioning the issue.

Jira Automation Steps

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/issueLink/{{issue.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:

{
    "<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

  • No labels