Forums

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

Is it possible to ammend a string to a customField?

Matheus F_ Nishida April 11, 2022

Hi All,

 

My idea here is to ammend any hardcoded string, e.g. "Hello World" to a customField inside JIRA smart value (JIRA Automation web request).

 

Does anyone knows if that's possible?

1 answer

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.
April 11, 2022

Hi @Matheus F_ Nishida 

Would you please provide more details about what you are trying to accomplish/dynamically update: the URL, the request data, something else?

For example, in another thread, I learned it does not appear to be possible to dynamically update (or even include) an issue key in the URL for a web request action to the Jira REST API.  So if that is what you wanted to do...it does not appear to work for Jira Cloud.

Kind regards,
Bill

Matheus F_ Nishida April 12, 2022

I'm working on a automation for JIRA function, to perform a web request to an external service.

 

The issue I'm facing is to build the JSON request, with custom fields. 

 

For example this is the POST request body:

 

{

    "field1": {{issue.custom_field1.value}},

    "field2": "Hello World" + {{issue.custom_field2.value}}     <----

}

 

How can I concatenate an string with a custom field inside a JSON POST request body?

Matheus F_ Nishida April 12, 2022

Hi Bill

 

I was able to solve my issue by concatenating the JSON body as per using the same template from the link you shared:

 

"testField1":"Hello World {{ issue.customfield1.value }}", 

 

And it worked!

Like Bill Sheboy likes this
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.
April 12, 2022

Matheus, I am glad to learn you got it to work that way.  There is also a concat() function to help with combining smart values, as described here:

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/#concat-String-str-

Matheus F_ Nishida April 12, 2022

I read that documentation, however it's not possible to concat a String first and, then, the custom field, right?

 

I can concat customfield with a "Hello World", but cannot do that the other way around, e.g. "Hello World" with customField

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.
April 12, 2022

That is correct.  As a work-around, you could first set the literal string to a Created Variable, and then concat() to that.

Like Matheus F_ Nishida likes this

Suggest an answer

Log in or Sign up to answer