Add the corresponding labels for the parser functions used in the use case. For example, add the label parser_func_previousvalue if the parser function previousValue() has been used.

On this page

Do not edit this macro

Use case

Get the contact information about the reporter of the issue from your Hubspot account and copy it into a Text Field (multi-line).

  Prerequisites

Remove this section if it is not required

Change the Title of the UI expand macro if used

 Create a Hubspot private app in your Hubspot account.

Visit https://developers.hubspot.com/docs/api/private-apps for more information.


 Select the following scope for the app.

crm.objects.contacts.read 

 


Store the access token for future usage in the Execute remote action post function.

 In Jira administration > Manage apps > Remote actions > Connections, create a new connection and name it. 

 Set the following base URL.

https://api.hubapi.com

 


Select the Bearer authentication method and enter the access token previously stored.

  Configuration

Add the Execute remote action post function to the desired transition.

Action

In Expert mode, create a new action with the following parameters:

Name

Enter Get Hubspot contact information as the name of the new action.

Method

Select the POST method.

Default connection

Select the connection with Hubspot.

REST path.

Use the following REST path.

/crm/v3/objects/contacts/search

Action body

Enter an action body like the following one.

This action body requests the company, address, city, phone number, mobile phone number and email from the Hubspot contact information of the reporter but it can be modified to satisfy your requirements.

{
"filterGroups": [
{
"filters": [
{
"values": [
"emailmaria@hubspot.com",
"%{issue.reporter.email}"
],
"propertyName": "email",
"operator": "IN"
}
]
}
],
"properties": [
"company",
"address",
"city",
"phone",
"mobilephone",
"email"
],
"limit": "10",
"after": "1"
}


Update issue fields

Update a Text Field (multi-line).

Select the option Set field value manually (parser expression).

Enter the following expression with the expression editor in Advanced text mode.

"*Contact information*" + "\n"+
"\n" +
(%{action.response.results[].properties[].company} != "" ? "|*Company*|" + %{action.response.results[].properties[].company} + "|" + "\n" : "") +
(%{action.response.results[].properties[].address} != "" ? "|*Address*|" + %{action.response.results[].properties[].address} + "|" + "\n" : "") +
(%{action.response.results[].properties[].city} != "" ? "|*City*|" + %{action.response.results[].properties[].city} + "|" + "\n" : "") +
(%{action.response.results[].properties[].phone} != "" ? "|*Telephone number*|" + %{action.response.results[].properties[].phone} + "|" + "\n" : "") +
(%{action.response.results[].properties[].mobilephone} != "" ? "|*Mobile*|" + %{action.response.results[].properties[].mobilephone} + "|" + "\n" : "") +
(%{action.response.results[].properties[].email} != "" ? "|*Email*|" + %{action.response.results[].properties[].email} + "|" + "\n" : "")

If the action body was edited, this expression should also be adjusted to the new request.



  Related use cases

Select in the filter the parent page in the With ancestor filter

JWT feature

Workflow function

Execute remote action

Parser functionsLinks to all used parser expressions (enter links separated by a blank space)
LabelIf proceeds, use the label staff pick