On this page

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

Hubspot private app

 Create a Hubspot private app in your Hubspot account.


 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.
Connection with Hubspot

 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

If you still have questions, feel free to refer to our support team.