Dynamically Update Custom Fields

Hi,

we have the following situation: We have several custom Jira Issue Fields and a Forge Custom Field for issues with a specific type. The Forge Custom Field is read only and derives its value from the other Custom fields. When a user changes one of the Custom Fields, the field with the derived value will not update since it is rendered on the server with UI Kit. This is not what a user would expect.

A similar problem was already discussed here.

Unfortunately the UI Modifications seem to be only feasible for Custom Fields in Jira but not with Forge. At least the API does not list Forge Custom Fields as viable targets to get or set values.

Another approach I was researching was the Issue View Background Script in Forge to listen for Change Events on the issue and then update the Forge Custom Field using the view.refresh() API. But using the refresh() API is not possible from the Background Script.

Is there any other way to update a Forge Custom Field asap when a Jira Custom Issue Field value is changed?

1 Like

Hi @mmoxter ,

If you implement the custom fields with Custom UI, you could use the events API to trigger re-rendering.

Regards,
Dugald

Hi Dugald,

thanks for your advice. As far as i know Custom UI can only be used for Custom Fields in editing but not when rendering?

1 Like

Hi @mmoxter ,

You’re right, I overlooked this limitation. To work around this, try taking advantage of the feature whereby the Jira issue view will automatically refresh if the issue is updated by a user other than the user that the issue view is open for. To exploit this, your app can update the issue using api.asApp() whenever you need the issue view to be refreshed. This is not ideal for the following reasons:

  1. It involves potentially unnecessary updates to issues.
  2. It is dependent on a behaviour of Jira that is not considered a supported API.
  3. There is a chance the api.asApp() call will fail due to differences between the app user’s and current user’s permissions.

A longer term solution would be a formal enhancement to our APIs. You may wish to request this by raising a FRGE issue.

Regards,
Dugald

Would UI Kit 2 (formerly known as client side UI Kit) solve the issue ?
Don’t know much about your issue, but curious to find out…

As far as I know I can’t use the events API in UI Kit 2 either. So this would not make a difference.

Thank you @dmorrow for the idea. Yet I’m not sure this is a clean idea as you stated yourself. I’m also exploring a different approach using a Jira Context with custom UI to set and show the fields values in combination with the displayConditions attribute for the custom fields to hide them in the Issue View. This way the Fields will not be shown with the other fields but should still be searchable with JQL and the data stored in the fields can be used in other (custom) views etc.

1 Like