The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

Convert object to string in Automation for Jira

Sam Huawey
Contributor
October 11, 2024

Is there a chance I can convert an object to a string using smart value functions?


{{customfield_10102}} gives me this:


ServiceDeskApprovalsBean{id='14000', name='Manager Approval', finalDecision='approved', canAnswerApproval=false, approvers=[ApprovalDecision{approverDecision='approved', approver=UserBean{ ...


When I try 

{{customField_10102.asJsonString}}

it gives me empty string.

I need to parse the object and extract approvers for later actions.

3 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

1 vote
Answer accepted
Sam Huawey
Contributor
October 11, 2024

Hm, after try and test I got it. ServiceDeskApprovalsBean is an object and I can access it by using keys of the object. In fact I have a list of two beans there and this code works pretty well for me

{{customfield_10102.first.name}}: {{customfield_10102.first.finalDecision}}\n\n{{customfield_10102.last.name}}: {{customfield_10102.last.finalDecision}}

So the receipt is:

1. Log custom field value and save output to say notepad
2. Ignore object name, check what is after first {
3. Use keys to extract data.

0 votes
Ratan Kumar
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 11, 2024

is jira usable for designers

 

0 votes
Sam Huawey
Contributor
October 11, 2024

I know I can make a REST API call to the issue and extract data from there, but maybe there is a function that can convert object to text? I assume asJsonString does not work because object is not a JSON.

DEPLOYMENT TYPE
SERVER
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events