I am trying to use automation to set the asset object field by using JSON additional field.
I saw a similar question posted:
It doesn't work when you try to use JSON and Advanced field editing. For me it worked, when I edited the custom object type field and set value as:
Someone answered it wont work if using additional field.
However, in my use case, I would have same field name for that asset object field, which means I must use JSON additional field.
Is it a bug or technial limitation that we cannot use additional field to set the asset object field?
---
We tried two cases but both failed:
1. Using lookupObjects
Then, we use edit issue in the automation with:
{
"fields": {
"customfield_10425": [{{lookupObjects}}]
}
}
The audit logs shows us the json field is not valid.
Then we tried to transform the data to be a valid json format as:
{"key": "xxxx"}
by using {{#lookupObjects}}{"key": "{{Key}}"}{{^last}},{{/}}{{/}}
2. Using tranformed lookupObjects
Then, we use edit issue in the automation with:
{
"fields": {
"customfield_10425": [{{#lookupObjects}}{"key": "{{Key}}"}{{^last}},{{/}}{{/}}]
}
}
The audit log and the automation run is success; However, the field didnt have a value we have passed.
So, is there any successful case that set an Asset Object field using the Additional Field (JSON) from Edit Issue in the Automation?
Finally I find out we can use id as the json key with workspace_id:object_id as json value to set the asset field.
{"id": "<<your_workspace_id>>:{{id}}"}
I got the hints from the API call from the field editing:
For my case, it would be:
{
"fields": {
"customfield_10425": [{{#lookupObjects}}{"id": "<<your_workspace_id>>:{{id}}"}{{^last}},{{/}}{{/}}]
}
}
For the workspace id, you can find it from the jira document:
https://developer.atlassian.com/cloud/assets/assets-rest-api-guide/workflow/
Hello @Joseph Lam ,
I would suggest you add more details while posting your questions including screenshots.
Vijay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here it's:
We tried two cases but both failed:
1. Using lookupObjects
Then, we use edit issue in the automation with:
{
"fields": {
"customfield_10425": [{{lookupObjects}}]
}
}
The audit logs shows us the json field is not valid.
Then we tried to transform the data to be a valid json format as:
{"key": "xxxx"}
by using {{#lookupObjects}}{"key": "{{Key}}"}{{^last}},{{/}}{{/}}
2. Using tranformed lookupObjects
Then, we use edit issue in the automation with:
{
"fields": {
"customfield_10425": [{{#lookupObjects}}{"key": "{{Key}}"}{{^last}},{{/}}{{/}}]
}
}
The audit log and the automation run is success; However, the field didnt have a value we have passed.
So, is there any successful case that set an Asset Object field using the Additional Field (JSON) from Edit Issue in the Automation?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
try this
{
"fields": {
"customfield_10425": [{{lookupObjects.jsonEncode}}]
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No luck,
lookupObjects.jsonEncode
will give us []
---
Finally I find out we can use id as the json key with workspace_id:object_id as json value to set the asset field.
{"id": "<<your_workspace_id>>:{{id}}"}
I got the hints from the API call from the field editing:
For my case, it would be:
{
"fields": {
"customfield_10425": [{{#lookupObjects}}{"id": "<<your_workspace_id>>:{{id}}"}{{^last}},{{/}}{{/}}]
}
}
For the workspace id, you can find it from the jira document:
https://developer.atlassian.com/cloud/assets/assets-rest-api-guide/workflow/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Joseph Lam
Welcome to the community.
Can you please show your automation (screenshots of the rule and steps) on what you have built so far.
What is the configuration of your custom field of type assets.
Also how doe the assets scheme and related objects to your question look like.
This will help members on the community to better understand your config and how you want to set it up.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.