Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Info to update custom fields in Edit Issue FIelds

Kathy Tempesta September 14, 2016

I was able to get an advanced rule set up for adding a participant but I can't get it to work for another custom field that is a single select. Using this code sample, I figured out that I need to change "add" to "set" but I can't figure out what I need to change "name" to. 

{
    "update": {
        "customfield_10003": [
            {
                "add": {"name""admin"}
            }
        ]
    }
}

2 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Kathy Tempesta September 15, 2016

Thanks! I will check that out and let you know how I do. 

0 votes
andreas
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.
September 14, 2016

Hi Kathy,

Thanks for trying out Automation for JIRA.  This advanced stuff isn't as easy as we'd like it yet, and we'll most likely add more 'simple' fields to our forms so that eventually you wont have to deal with this.

Now to get more information about what values are valid in the JSON you can get the 'editmeta' information from JIRA. For example https://<YOURINSTANCE>/rest/api/2/issue/<YOURISSUEKEY>/editmeta returns this for a single select field:

{
  ...
  "customfield_10400": {
    "required": false,
    "schema": {
      "type": "option",
      "custom": "com.atlassian.jira.plugin.system.customfieldtypes:select",
      "customId": 10400
    },
    "name": "Single Select",
    "key": "customfield_10400",
    "operations": [
      "set"
    ],
    "allowedValues": [
      {
        "self": "https://goonbag.atlassian.net/rest/api/2/customFieldOption/10100",
        "value": "red",
        "id": "10100"
      },
      {
        "self": "https://goonbag.atlassian.net/rest/api/2/customFieldOption/10101",
        "value": "blue",
        "id": "10101"
      },
      {
        "self": "https://goonbag.atlassian.net/rest/api/2/customFieldOption/10102",
        "value": "green",
        "id": "10102"
      }
    ]
  }
  ...
}

 

This gives you a few hints as to what you can specify in the advanced section. In particular the 'operations' and 'allowedValues'.

With the field above I can use this in the advanced block:

{
    "update": {
        "customfield_10400": [
            {
                "set": {"value": "green"}
            }
        ]
    }
}

So I use the custom field id, with the only available operation "set" and set its "value" to one of the allowedValues "value" of "green".

Hopefully this helps. If not, can you please provide the editmeta JSON for your issue and I should be able to provide the correct advanced config.

TAGS
AUG Leaders

Atlassian Community Events