Symptoms
When a change is made in the datasource, it's not automatically reflected in the Connect field.
Example
Let's take the example of the following SQL table:
|
user_id |
user_firstname |
user_lastname |
|---|---|---|
|
1 |
Simon |
Laffont |
|
2 |
Napoléon |
Bonaparte |
|
3 |
Gengis |
Khan |
|
4 |
Frédéric |
Barberousse |
Let's say we want to display the user firstname. So here is the Connect field configuration we have set up:
When we populate this Connect field in an issue, everything works fine:
But as soon as we change this value in the datasource, this modification is not reflected in the Connect field:
Cause
This problem occurs because a Connect field key has been changed:
It is important to know that the key is used to set the link between the datasource and the Connect field. When it's changed, the Connect field key is no longer relevant and the Connect field can no longer retrieve the corresponding value from the datasource.
Resolution
1. Change the Connect field key
To solve this problem, you have to change the key and choose another column that never changes. In our case, the user_id column is the most appropriate so we update our Connect field accordingly:
2. Update the relevant issues
As your key has been changed, all issues in which the Connect field already contains a value must be updated because this value corresponds to the old key which is no longer relevant. To do this, you need to edit your Connect field query and write a temporary query using $currentCustomfieldValue. This variable is used to retrieve the currently selected value stored in Jira.
In our case, the old key was user_firstname so here is the temporary query we need to write:
Then, the Connect field must be updated using one of the methods described in the following documentation: How to set Elements Connect field on existing issues?
SELECT user_id, user_firstname FROM user
WHERE user_firstname IN ($currentCustomfieldValue.stringList())
Once the Connect field has been updated in all relevant tickets, then restore the query to its original state: