Utilizing smart values in fields during automation

Nita Brumbaugh May 13, 2021

I have this smart value that I am utilizing from the description field to extract the information between pieces of data in the description field in automation to populate a customized field in the Jira instance:

{{issue.description.substringBetween("Name: GMRCNT\","Host Name"}}

 

I can't get this work anyway possible.  I've looked at the following links of documentation regarding smart value:

https://confluence.atlassian.com/sneaky/jiracorecloud/advanced-field-editing-json-996709925.html

https://support.atlassian.com/jira-software-cloud/docs/smart-values-text-fields/

https://community.atlassian.com/t5/Jira-Software-questions/invalid-json-in-automation-for-jira/qaq-p/1506271

And a few other kb articles.  I have had all kinds of errors, but this is the last one  It gives me:

Failed to get value for issue.description.substringBetween("Name: GMRCNT\","Host Name")

 

I utilized this same format substring in another automation rule by populating a field with a description and it works fine with no errors:

{{issue.description.substringBetween("Case # ","Subject:")}}

 

Both my fields are the same format and on the screens.

 

Any suggestions on what to try to get the information between 2 pieces of data in the Description jira field???

2 answers

0 votes
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 13, 2021

Hi @Nita Brumbaugh 

I wonder if the slash character is not being accepted in the search parser.  Please try to remove that character to see if it works.  If so, that would isolate the problem and then you could try to either escape the character or just use remove() after pulling out the substring.


Best regards,

Bill

Nita Brumbaugh May 13, 2021

I did remove the / and it still doesn't work.  The unfortunate part is that I need the text right after the GMRCNT\

Nita Brumbaugh May 13, 2021

do you mean to extract the value with the / and then remove the /?  Not sure what you me about escape the character

Thanks

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 13, 2021

Hi!  Okay I did some quick tests, and found that the substringBetween() is parsing stuff following the \ as a prefix for a special character.  If you change your search to use \\ in place of any \ it should work.

Nita Brumbaugh May 14, 2021

Bill,

It kind of worked.  I don't know how to solve the error that I got or remove the special characters in the field.

Here what the field displays as it has the > and a space before the user name:

Network Name: > nbrumbaugh

There is some kind of special character that I can't see in Jira.   when I edit the field it just shows a space before nbrumbaugh

Here are my input lines to extract the user name from:

User Name: GMRCNT\nbrumbaugh
Host Name: DG47YY2-LT.gmrcnt.local Client Name: DG47YY2-LT

This is the error I am receiving in the audit log:

Issue was edited successfully, however some unexpected errors occurred -sd.request.update.request.type.error

Farther than I was though - Thank you! - I am assuming the \ is creating the special character.   Any suggestions?

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 14, 2021

Nita, now that you have the value, please try adding a trim() after the extract.  That should remove any leading/trailing whitespace or control characters in there.

https://support.atlassian.com/jira-software-cloud/docs/smart-values-text-fields/#Smartvaluestextfields-trim--

0 votes
Fabian Lim
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 13, 2021

Hi Nita,

Can you please share your audit log when the rule is triggered?

Regards,

Fabian

Nita Brumbaugh May 13, 2021

2021-05-13_17-07-38.png

Suggest an answer

Log in or Sign up to answer