Table of Contents
Once an Elements Connect field is configured, it won't just appear on Jira issues, it needs to be set (populated).
To set an Elements Connect field on new issues, there are several possibilities:
- Manually at issue creation.
- By using our dedicated post function Set a field value.
- By using a 3rd party add-on:
But, what about setting the field on existing Jira issue?
Three options are available, the first one depends only on Elements Connect and a Jira functionality, where the other two solutions depends on a 3rd party Apps.
It's important to mention that this KB is to set an Elements Connect field with no dependencies (no reference to $issue in the field configuration).
If the field that needs to be set has a dependency to another field, then, parent field needs to be set separately by using one of the below methods.
By creating a temporary transition
- Per project, create a new temporary transition that doesn't change the workflow status: from status Any status, to status Itself.
- This transition could be deleted after the Connect field is set, or it could be hidden by adding a condition on the transition: Condition to hide a transition from the user.
- Edit the new transition and add our dedicated post function Elements Connect: Set a field value to set the Connect field.
- Select the Connect field you need to set on the issues.
- We can add as many fields as needed.
- Publish the workflow.
- In Jira issues, run a JQL query that will retrieve the issues where we need to set the Connect field.
- From Tools, select "Bulk change".
- Select all the issues, click "Next"
- in case of doubt, it could be done on one issue to ensure everything is working as expected, later-on, apply it on remaining issues.
- Select "Transition Issues" operation, click "Next".
- Select the created transition, click "Next" till confirming the transition of the issues.
- The above bulk operation might need to be done several times because it's per status. If the issues are in different statuses, repeat the above.
- Finally, ensure that the issues were correctly updated.
By configuring an Automation rule
- From the administration page of Automation for Jira, click on "Create rule".
- Select the Scheduled trigger.
- Set the rate on running the rule, 7 minutes for example (the number is not important as the rule will be run manually and for one time only).
- Set the JQL query that will retrieve the Jira issue where the Connect field is not populated.
- Click "Save".
- Add Component: New Action.
- Select "Set Elements Connect field value action"
- In "Fields to set" list, select the Connect field you need to set.
- Click "Save", name the automation rule, click "Turn it on".
- Click "Run rule" (in the Audit log, you can check tickets that were updated).
- Ensure that the field is well populated on the concerned tickets
By running a script
In ScriptRunner script console, paste the below script:
This script should be adapted to match the user needs by updating the below:
- JQL_QUERY: write the JQL query that will retrieve the issues where we will set the Connect field.
- customfield_XXXXX: the Connect field ID.
- If we need to set more that one field at the same time, we should add these lines of code: