Hi
I want to access attribute values in an Assets object i.e. address details for an email or store in a text field.
I am using JMWE at the moment but could also try Scriptrunner if there is a solution there.
I can see my object using
{{ issue | insightFieldValue("customfield_10076") | first | field("label") }}
But I want to get at the attributes. The structure I can see via a dump() is
{
"id": "ed27ff36-cae3-4680-979c-a7457da17e:3496",
"objectKey": "ITEM-3496",
"label": "Site 1",
"objectType": {
"id": "ed27ff36-cae3-4680-979c-a7757da17e:16",
"name": "Site"
},
"attributes": {
"country": {
"value": "England",
"displayValue": "England",
"searchValue": "England"
}
}
}
Any one else solved this?
Hi @Tom Lister
since this seems to be a single-value Insight field, you don't need to use the "first" filter (which is needed when the value is an array).
So to access the label of the Insight object, you can do:
{{ issue | insightFieldValue("customfield_10076") | field("label") }}
And for, say, the country name:
{{ issue | insightFieldValue("customfield_10076") | field("attributes.country.value") }}
Brilliant - just the job
{{ issue | insightFieldValue("customfield_10076") | first | field("attributes.country.value") }}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @David Fischer ,
Thank you very much for sharing. I want to traverse through the values of a multi-value asset object field and compare the values with string values. Is it achievable with JMWE?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Swapnil Srivastav ,
yes, this is doable, you'll need to write some Nunjucks code, using the for statement:
{% for item in issue | insightFieldValue("customfield_10076") %}
{% if item.attributes.country.value == "some string" %}
SOME VALUE
{% endif %}
{% endfor %}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Progressing slightly.
I can see the attributes only using
{{ issue | insightFieldValue("customfield_10076") | first | field("attributes") | dump() }}
The question now is how filter the value for "country"
I can find it by "value"
{{ issue | insightFieldValue("customfield_10076") | first | field("attributes") | filter({value:"England"}) | first | dump() }}
{"value":"England","displayValue":"England","searchValue":"England"}
but i want to find specific values by attribute name
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Currently struggeling with the same approach.
----
{{ issue | insightFieldValue("customfield_10076") | first | field("attributes") | first | dump() }}
----
But attributes is always empty.
maybe there is a way to get the asset attributes with the restAPI Filter "callRest" from JMWE
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Appfire Support {Appfire} can you confirm that the field "attributes" is empty or is this a bug at jmwe or atlassians implementation?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Felix Haverkamp , Good day!
Hello, this is Avinash from the Appfire Product Support Team.
I am currently reviewing your request and will provide you with updates through the support ticket you raised. Furthermore, I will also share the final outcome here.
Thank you,
Avinash
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Felix Haverkamp Good day!
We would like to update you that this issue has been fixed as part of our latest release. please validate again. Please let us know if you have questions.
Thanks,
Avinash
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Solved:
I can confirm its working now.
In Nunchuck we have now very much information about the assets.
Remember: Nunchuck Templates are currently not available in conditions nor validators. That would be absolute great, but there is an issue at Atlassian Bug Tracker: https://jira.atlassian.com/browse/JSDCLOUD-12479
have a g´day
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.