Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Data in Jira Automation Rule

Ali Masri February 6, 2024

Hello,
I am working on using Jira Automation to send issue updates to Google PubSub. However, I am facing challenges with the message format required by PubSub, which involves using a Json Object with a messages array, containing an array of data elements that need to be base64 encoded.
I have created a custom data format that matches this requirement, but it involves specifying the fields one by one.

{
"messages": [
{
"data": "{{#base64Encode}}{"key": "{{issue.key}}","project": "{{issue.project.key}}","status": "{{issue.status.name}}","summary": "{{issue.summary}}","description": "{{issue.description}}","priority": "{{issue.priority.name}}","issuetype": "{{issue.issuetype.name}}","creator": "{{issue.creator.emailAddress}}","reporter": "{{issue.reporter.emailAddress}}","assignee": "{{issue.assignee.emailAddress}}","created": "{{issue.created}}","updated": "{{issue.updated}}","issue_links": "{{issue.issuelinks.id}}"}{{/base64Encode}}"
}
]
}


Is there a way to access the entire issue body in JSON format and base64 encode it without making an extra REST call to the JIRA API? I want to utilize the issue smart value itself to access this data. Any suggestions or solutions would be greatly appreciated.
Thank you!

1 answer

1 accepted

0 votes
Answer accepted
Rebekka Heilmann _viadee_
Community Champion
February 13, 2024

Hi @Ali Masri and welcome to the Community!

I struggle a bit to understand what direction you need help with. Can you elaborate?

The Jira API returns the issue in the Response body and you can access all values with smart values. So not sure what you mean.

Ali Masri February 13, 2024

Thank you @Rebekka Heilmann _viadee_ :)

The problem I am facing is that there is no smart value that returns the complete Jira Issue body as a single json object.

For example: {{ issue }} only returns the issue key and not the whole issue body that I need to base64Encode and send to PubSub.

On the other hand, I cannot use smart values to access one field at a time because I do not know all the fields that may exist in an issue (given that there are a lot of custom_fields that keep changing).

I hope I made it clear, if not please let me know and I can elaborate with examples.

Note: Using other Web Request Body options (Issue data Automation Format or Issue data Jira format) is not a solution because I cannot call the base64Encode function on the body before I send it to PubSub.

Rebekka Heilmann _viadee_
Community Champion
February 13, 2024

I see.

You said in the question "without an extra API Call", but I think you're only option is the API Call (Get Issue by Issue Key). You can access the Request Result including the issue's body.

Jira Automation is designed to access single values directly and not work on JSON format.

Ali Masri February 13, 2024

Oh ok then, I guess I have to go with the API call option. Thank you very much for your support.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events