Forums

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

Smart Value string functions

Dillon Weyer
Contributor
October 19, 2022

Hi All,

I have a custom field for the team name. I have set up an automation to clone an issue when this custom value is set. ~I found an article which described how you could use string functions to use part of a custom field to set a smart value. In my case I want to create the issue in the related team's project. I updated the team's values and appended the project ID to the name e.g. Team Name - 10845

 

When I add the following to smart value, I get the following error:

The provided smart value was unable to be resolved to an object.
This is what I am using:
{{fields.customfield_10155.substringAfter("-")}}
Based on the following it seems like you can use these functions in a smart value:
Anyone able to offer any guidance of where I am going wrong please

1 answer

1 accepted

1 vote
Answer accepted
Trudy Claspill
Community Champion
October 19, 2022

Hello @Dillon Weyer 

I suspect this issue is that you specified fields rather than issue. Try making that change and see if your problem is solved.

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.
October 19, 2022

Hi @Dillon Weyer 

Yes, and...to Trudy's suggestion:

If you literally are using "Team Name - 10845" then your substringAfter should account for that leading space character, such as with:

substringAfter("- ")

By the way, for a question like this I'd recommend including images of your complete rule and of the audit log details showing the rule execution.  Those may provide more context for the community to help.  Thanks!

Kind regards,
Bill

Dillon Weyer
Contributor
October 20, 2022 edited

Thanks so much for the reply @Trudy Claspill and @Bill Sheboy I made the change as per your suggestion, but still getting an error when used as a smart value. For testing, I have included the following insert comment to validate what the value outputs are:

Team Project Code using team name field and using subString: {{issue.customfield_10155.substringAfter("- ")}}

Team name without subString: {{issue.customfield_10155}}

The first one returns the text but no value for the custom field

The second one returns the custom field fine.

I have also included screenshots now as per your suggestion:

-DFT-603-This-is-a-test-Jira.png Automation-Jira (2).png Automation-Jira (1).png Automation-Jira.png

Dillon Weyer
Contributor
October 20, 2022

managed to get it to work, needed to add .value i.e 

{{issue.customfield_10155.value.substringAfter("- ")}}

 

once again, thanks for the support

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.
October 20, 2022

Well done, Dillon!  Any my error, as I should have asked if you had a single-select or text field; that impacts what is available in the smart values.

When in doubt of the smart values, or when something does not work as expected, this how-to article helps to find the supported smart values for an issue: https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/

Like • Dillon Weyer likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
atlassian, team '25 europe, atlassian event, barcelona 2025, jira, confluence, atlassian intelligence, rovo, ai-powered collaboration, developer tools, agile teams, digital transformation, teamwork solutions, atlassian conference, product announcements

🌆 Team '25 Europe registration is now open!

Join the largest European gathering of the Atlassian Community and reimagine what’s possible when great teams and transformative technology come together. Plus, grab your Super Fan ticket now and save over €1,000 on your pass before prices rise on 3 June.

Register now
AUG Leaders

Atlassian Community Events