Forums

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

Manipulate string to capitalize each word in the field

Jakob Kristoffersen February 20, 2023

Hi Jira community,

I have read through the documentation here Jira smart values - text fields | Cloud automation Cloud | Atlassian Support on the different string manipulation methods available to format Jira Smart Values.

 

I need to capitalize each word in a field but I note that the "capitalize()" method only capitalises the first word in a field. 

 

Use case example:

A text field contains the value "john smith". I need a method to transform the field value to "John Smith".

 

Do you know if such a method exists on Jira? I can't seem to find anything in the documentation.

 

Thank you,

Best regards

Jakob

1 answer

1 accepted

1 vote
Answer accepted
Marini Marini
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.
February 20, 2023

Hi @Jakob Kristoffersen 

You can combine multiple functions just like how we use them in Javascript. So in this case, you want to do the following:

1. Get the value of the custom field e.g. fullname

2. Split the text value bye .g. a space

3. Capitalize the first letter for each word

4. Join each word separated by e.g. a space

Try to use the following smart value:

{{issue.fullname.split(" ").capitalize().join(" ")}}

I hope it helps.

Best Regards,

Marini

Jakob Kristoffersen February 21, 2023

Hi Marini,

Your suggestion worked. Thank you very much.

Best regards

Jakob

Suggest an answer

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

Atlassian Community Events