Dear Community!
Trying to test scripts in Jira and I ran into a problem, is it possible to change the tag values already in the custom field?
Field:
"tags":[
{"tag":"TAG1","value":"VALUE1"},
{"tag":"TAG2","value":"VALUE2"},
{"tag":"TAG3","value":"VALUE3"},
{"tag":"TAG4","value":"VALUE4"}]
And you need to put certain customfields values instead of json values.
Is it possible via automation or scriptrunner os something else?
Thanks a lot!!
Hi @Petr AST - Can you please provide a little more context? If I understand correctly, you have a field called Tags. What would help me better understand:
Hi @Mark Segall!
Thanks for you reply!
There is a customfield, which already contains a json value from integration.
I need to change the values in this field so that the values can be taken from customfield_1, customfield_2 and customfield_3 for example:
"tags":[
{"tag":"TAG1","value":"customfield_1.value"},
{"tag":"TAG2","value":"customfield_2.value"},
{"tag":"TAG3","value":"customfield_3.value"},
{"tag":"TAG4","value":"VALUE4"}]
Trying to test this script:
import groovy.json.JsonSlurper String jsonInputString = '''
{"tags":[
{"tag":"TAG1","value":"VALUE1"},
{"tag":"TAG2","value":"VALUE2"},
{"tag":"TAG3","value":"VALUE3"},
{"tag":"TAG4","value":"VALUE4"}]}
''' def json = new JsonSlurper().parseText(jsonInputString) json.tags[0].value = 1234 json.tags[1].value = 12345 println json
It returns me sucess result in logs
[tags:[[tag:TAG1, value:1234], [tag:TAG2, value:12345], [tag:TAG3, value:VALUE3], [tag:TAG4, value:VALUE4]]]
But how can I change this in the customfield itself in the issue, can't figure it out?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.