Retrieving values from a field and setting the value for a field are very simple.
First, you need to be able to identify the field. This can be done in three
different ways:
By the fields name
By the fields id
By the fields alias
For more information about using custom fields see: Variable resolution
For more information about aliases see: Custom Fields Aliases
Getting Values
NOTE: This script assumes that it is running in the context of an issue. Like in a workflow script or listener for example. If you would like to test this script from the SIL Manager, add an issue key to test with under the Run Configuration setting (Run > Run Configuration > Context).Example 1A - By name
string color = Color;
Example 1B - By name with spaces
string color = #{Product Color};
Example 2 - By id
string color = customfield_12345;
Example 3 - By alias
string color = productColor;
Setting Values
NOTE: This script assumes that it is running in the context of an issue. Like in a workflow script or listener for example. If you would like to test this script from the SIL Manager, add an issue key to test with under the Run Configuration setting (Run > Run Configuration > Context).Example 1 - By name
Color = "Red";
Example 2 - By id
customfield_12345 = "Blue";
Example 3 - By alias
productColor = "Green";
NOTE: This information only applies to custom fields. For standard Jira fields (like summary)
an alias has already been created and is available to use. For more information
see Working with Standard Fields.