Split() - Split will result in an empty character.
Asked by ???:

Sorry if this is hard tounderstand as it it a machine translation.

I am in the process of creating a process to split the value of a custom field in an automated process and store it in a variable.

\*Use smart values.

Trying it out in the "comments to the issue" section, Get the value of the custom field, The result of the split is empty.

Is there an incorrect way to specify the smart value?

In addition, the following is what is specified in the custom fields and smart values.

?Custom fields?

Type: single picker

Content:??_???#1:dp0vmpx201

?AutomationProcess?

Smart value:{{issue.????????.split(":").second}}

{{issue.????????}},it will be displayed without any problem.


Answers:
author: Kevin Patterson
body: Hi [@???](/t5/user/viewprofilepage/user-id/5548938) ,

If I understand your needs correctly you have a text string in a custom field that will contain the character : and you would like to extract the second value dp0vmpx201. If this is correct I believe your issue is with the .second you are using in the split function. see below for what you can use to retrieve either side of the string from your custom field.

**{{issue.????????.split(":").get(0)}}** should return ??_???#1  
**{{issue.????????.split(":").get(1)}}** should return dp0vmpx201

Let us know if this works, if not someone else might have an alternate approach that could work.

comments: author: ???
body: Thanks [@Kevin Patterson](/t5/user/viewprofilepage/user-id/5497084)

I ran the "Add a comment to the issue" with the smart value you provided.

smart value?{{issue.????????.split(":").get(1)}}

The result was still the same: empty text.

I am also using if conditions, etc. in an automated flow.  

Does the composition of the flow, etc. have an effect on this?


author: Kevin Patterson
body: Hi [@???](/t5/user/viewprofilepage/user-id/5548938) , if the action setting the smart value is done inside the if conditions and those conditions are not met then this could have an impact. For testing i'd recommend creating a separate automation rule that has a manual trigger and only has the smart value and add comment actions. Once you get this working you can validate that the **{{issue.????????.split(":").get(1)}}**extracts the correct value and the move on to troubleshooting your other automation rule. I've tested this in one of my instances and it looks to be working as expected. for my testing I added your text string to description and configured my smartvalue to pull out the value to the right of the : in the string.

automation rule:

![automation.png](https://community.atlassian.com/t5/image/serverpage/image-id/341995iEC516C77AB220222/image-size/large?v=v2&px=999 "automation.png")

Issue with automation rule populating comment:

![issue.png](https://community.atlassian.com/t5/image/serverpage/image-id/341996i339B1A04DD12E1E1/image-size/large?v=v2&px=999 "issue.png")


author: ???
body: hi, [@Kevin Patterson](/t5/user/viewprofilepage/user-id/5497084)

In this case, the custom field for which the desired processing was to be performed had a single picker selected as the type.

In that case, it seemed to have the data internally in an array, so I gave it a ".value" as follows, and it worked.

{{issue.????????**.value**.split(":").get(1)}}

Thanks for taking the time to discuss this with me.


Tags: cloud

jira-service-management

jira-service-management-cloud