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.
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.
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.
Note that the reporter should have set the visibility of his email address to public to be able to obtain it.
{
"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 General mode.
%{"*Contact information*" + "
"+
"
" +
(%{action.response.results[].properties[].company} != "" ? "|*Company*|" + %{action.response.results[].properties[].company} + "|" + "
" : "") +
(%{action.response.results[].properties[].address} != "" ? "|*Address*|" + %{action.response.results[].properties[].address} + "|" + "
" : "") +
(%{action.response.results[].properties[].city} != "" ? "|*City*|" + %{action.response.results[].properties[].city} + "|" + "
" : "") +
(%{action.response.results[].properties[].phone} != "" ? "|*Telephone number*|" + %{action.response.results[].properties[].phone} + "|" + "
" : "") +
(%{action.response.results[].properties[].mobilephone} != "" ? "|*Mobile*|" + %{action.response.results[].properties[].mobilephone} + "|" + "
" : "") +
(%{action.response.results[].properties[].email} != "" ? "|*Email*|" + %{action.response.results[].properties[].email} + "|" + "
" : "")}
If the action body was edited, this expression should also be adjusted to the new request.
📚 Related examples