JMWE Cloud: Inserting values into Asset fields
Problem
Asset (formerly Insight) fields in Jira Cloud use object IDs rather than plain text values. Attempting to set them like standard custom fields — e.g., by passing a display name — will result in errors.
Solution
Create a Set issue fields post function in your desired workflow configuration.
Press the “Add” button and look for your asset field
A Nunjucks editor will open, where you can write the Asset Id. For multiple values, they only need to be separated by a comma.
The Id for the asset must be previously known. You can find the id of an asset by adding it to this field on an issue and testing the script against that issue in the following manner, where
customfield_11300is an Asset field:
The value you need to return to populate the field is located in the “ID” key, with the format of the ID as <workspaceId>:<key value>.
Tip: If you need to set Asset fields dynamically, consider using the Assets API or AQL queries within your Nunjucks expression to look up the ID at runtime.