Forums

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

Automation rule takes first line of multiline text field and adds it to a single-line text fiel

Iana
Contributor
May 2, 2024

Hello,

I would like to create an automation rule that takes the first line of a multiline text field (description) and adds the content to a single-line text custom field. 

How could I do this?

Thanks in advance.

 

2 answers

1 accepted

1 vote
Answer accepted
Bill Sheboy
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.
May 2, 2024

Hi @Iana 

You may split the description into a list using the newline character, and then use the get() function to access the values.  The first item in the list has an index of 0, and so this would work:

{{issue.description.split("\n").get(0)}}

To learn more about these functions, please look here:

Kind regards,
Bill

Iana
Contributor
May 7, 2024

Just what I was looking for. Thank you

Like Jeffrey Breault likes this
0 votes
Manoj Gangwar
Community Champion
May 2, 2024

Hi @Iana 

Here's a basic example of how you might set up the action:

  • Choose "Edit issue" as the action.
  • Select the single line text field you want to copy the first line to.
  • Use a smart value to extract the first line of the multiline text field. For example, if your multiline text field is called "Description", you could use something like {{issue.Description.split('\n')[0]}} to get the first line.
  • Map the extracted value to the single line text field.
Bill Sheboy
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.
May 2, 2024

Hi @Manoj Gangwar 

That is not the correct syntax for accessing a list of values with smart values in Atlassian automation rules.  Please look here to learn more in the automation documentation: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-lists/#list.get-index-

Kind regards,
Bill

Like Manoj Gangwar likes this

Suggest an answer

Log in or Sign up to answer