Summary
Custom field values can be set on a per-project and/or per-rule basis in your JEMHCloud profile, where they are called Custom field defaults.
Go into your profile and configure it by clicking the small cog beside it. Go into the Project Mappings view. You can either configure the new Custom Field Default to be at the default project mapping resulting in your other mappings inheriting it, or you can configure it to only be in one of your non-default project mappings.
Click the little cog beside the project mapping you've elected. Go into the Issue tab and click the Edit button found towards the top right. Scroll down until you see the Custom field defaults section.
Setting a Static value
The simplest way to set a custom field is by passing a static text-format value. Find the desired custom field from the list. Ensure that the drop-down at the end of the row is set to Text, and enter a value to be used for this project mapping/rule.
Once a value has been entered, you can then select when this value should be set (issue creation, issue comment, both). Finally, submit the form to save your changes.
Setting a Dynamic value
To set a dynamic value this will require a Velocity script to gather the value. When the script is parsed it will result in whatever value is present in the template after rendering being set as the value for the Custom Field.
Velocity Context
When you create a dynamic Custom Field Default, you can make use of special variables found in the ‘context’, see them through:
Profile > Project Mapping > Issue > Edit
Steps to set create a Velocity Custom Field Default
Default custom field values are set in Project Mapping and resolved when an email is processed.
Go to Profile > Project Mapping > Issue > Edit
Under CUSTOM FIELDS DEFAULTS you will see the available custom fields for the project mapping's project.
Find your custom field, select Velocity and when you want the field to be updated e.g. On Create/Comment.
Enter the relevant script within the text-box
See the following page for some example Velocity Scripts: Velocity Script Examples
When are custom field values applied?
Certain configurations will require Custom Fields to be associated with the correct configuration screens. Please refer to https://support.atlassian.com/jira-cloud-administration/docs/manage-issue-screens/ for further information on configuring custom fields in your Issue screens.
Issue Create
JEMHC will attempt to set Custom Field values during Issue create if the custom field is visible on the Issue Create Screen for the associated Project.
Issue update
If a field does not match the above criteria, JEMHC will attempt to update the Issue after the create request has been made. This requires the custom field to be visible on the View/Edit Screen for the associated Project.
What happens if I attempt to set a custom field value to a field not present on create or edit screens?
If the field is not set in the create screen, it attempts to be updated using the edit screen. If the field is not visible on edit, you will receive the following error in the audit report (where X
is the field without create/edit association):
Field 'X' cannot be set. It is not on the appropriate screen, or unknown
To resolve this, the field must be added to either the issue create screen or edit screen.