Forge custom field value function

Hi,

We have a few custom fields implemented using “jira:customField” module. You can provide a value function which calculates the field value from the issue everytime the issue is viewed. Since issues are rarely change and viewed a lot between changes, this function calculates the same value, %99.99 times. But even if the function returns the same number everytime, issue is updated at every view due to this value function and issue update trigger is called. The function returns a number, not an object. Is there a way to ignore the issue update if the returned value of the function is the same with the current value of the field on the issue?

1 Like

Hey @denizoguz, we had a similar use case (we want to read the field value from an issue property, which was easy to do on Connect).

Based on the docs, we also first looked at the value function, but there were too many issues with that approach.

I do not think this is explicitly mentioned in the docs, but declaring view.formatter.expression solved the problem for us - no value function needed. Our expression in the manifest.yml looks like this:

"issue?.properties?.['my-property-key']?.count ?? 0"

This appears to be very similar to the virtual read-only field we had on Connect, and it does not create issue updated events or require you to set the field value manually by calling the Jira API.

I am not sure if this helps with your use case, but I thought I would share our results in case it does.

1 Like

Thanks for the information @tbinna. For our case, JQL is not working if we don’t provide a value function. Because the field doesn’t have a value and not indexed. Also, when the issue is exported, the field value is not exported if we don’t have a value function. These are really basic things and hopefully we are missing something.

@denizoguz I am not sure about JQL, but the export worked for me without the value function when I tested it last week. Since our field data is stored in an issue property, we use the Jira entity property module to index and expose the property to JQL.
I will test querying the field via JQL when I have time. If it does not work, it would not be great for the user experience, however, the module essentially provides an equivalent replacement for that.

1 Like