Forums

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

How to remove square brackets from picklist value

Zaldy Parian
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 15, 2023

Hi all,

Hoping someone can help me with my problem. I searched around about removing square brackets in this community website and also google. But I can't seem to find the answer that could help me.

My problem is, I'm using lookupIssues to get all approvers of all request tickets. The Approvers field is a custom field, and it has one or many picklist value. I tried this piece of code in the automation log just to see the list of approvers that I need to send the email to: 

Approver list: {{#lookupIssues.customfield_10003.displayName.distinct}}{{.}};{{/}}

However, the list I got has square brackets in each name; e.g. [John Smith]; [Jane Doe]; [Steve McQueen]

The JQL for my lookupIssues is like this:

project = SIT AND status = "Waiting for approval" AND "Approvers[User Picker (multiple users)]" is not EMPTY

Ultimately, my goal is to get the list of approvers and put them in the To: field of an email to remind the approvers of the pending requests.

Can someone please help guide me how I could remove the square brackets from the resulting list of approvers? Or is there a better to get to my goal?

 

Cheers.

1 answer

0 votes
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 15, 2023

These are not really Brackets in the text, and they're telling you that each name is a value in an array or list.  The brackets are acting as item delineators, not text.

This is because a multi-picker is a list of options.

You do not need to "remove brackets", you should iterate over the returned list.

Zaldy Parian
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 15, 2023

Hi Nic,

As always, I appreciate your quick responses to my queries.

Apologies if I'm a bit lost here. By "you should iterate over the returned list.", what/how exactly would I do this?  Would be able to give me some example?

email_list.png

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 15, 2023
Zaldy Parian
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 15, 2023

I tried havig this in the log:
Approver list: {{#list}}{{customfield_10003.displayName.distinct}}{{.}};{{/}}

But I got a blank result. 

Perhaps my syntax is wrong?

log_action.png

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events