How to update custom field options using Jira CLI

This article provides detailed guidelines on how to update the custom field options using the Jira Command Line Interface(JCLI).

Instructions:

Since Bobswift's CLI client version 9.6.0, we have a new feature that can update custom field options.

  1. How to use the action:
    • Run the updateCustomFieldOptions action to update existing options and cascade option values:
      Action Command:

      --action updateCustomFieldOptions --field demo --options "oldVal:newVal" --options "existingOption:newOption"
      --action updateCustomFieldOptions --field demo --options "parent - oldChild:parent - newChild"

      Examples:

      multiple-select field:
      
      //update "E" to "e1", "f" to "f1"
      --action updateCustomFieldOptions --field zzselect1 --options "E:e1" --options "f:f1"
      
      //update "G" to "g2", "g2" to "g3"
      --action updateCustomFieldOptions --field zzselect1 --options "G:g2" --options "g2:g3"
      
      //update options with id = 15910 to new value 'i2'
      --action updateCustomFieldOptions --field zzselect1 --options 15910:i2
      
      multiple-select-cascade field:
      
      //update parent option from 'E' to 'E1'
      //update cascade/child option from 'f1' to 'f2'
      --action updateCustomFieldOptions --field zzcascade-select --options "E:E1" --options "F - f1:F - f2"
      
      //if the value contains dash, use this quote to note it is part of the value, not a parent-child relation
      --action updateCustomFieldOptions --field zzcascade-select --options "'Parent - (dash)' - 'Child - (dash)':'Parent - (dash)' - Child without (dash)"
      
      //use id for the parent
      --action updateCustomFieldOptions --field zzcascade-select --options "15925 - g1:15925 - g2"
      
      
  2. Guidelines to use the action:
    1. use " - " to represent a parent-child relation. If " - " happens to be part of the value, use single quote ('') to enclose the entire value.
    2. use ":" to represent current value and new value relation. "A:B" means update option "A" to option "B". 
    3. You can use id instead of value of the current parent option or child option.
  3. Invalid input will be pre-checked and error out, list of common pre-check errors:
    1. "A:A" ---- current value and new value are equal
    2. update cascade option value for a non-cascade custom field option
    3. "A - a:B - b" ---- update cascade option, but they have different parent
    4. "A - a:A" or "A - a:A - " ---- update cascade option to empty value, this is not valid, use 'removeCustomFieldOptions" instead
    5. "A - a,b:A - x,y". ----- update multiple values together