Override field display in on-demand connect add-on

It is great news that On Demand allows for custom filed creation using the jiraIssueFields module, but I am unsure how you override the field display.

Previously this was done on the server side using Velocity templates but from checking the documentation and the sample add-on, I couldn’t work out how to do this.

My end goal is to override the field’s rendering on the create and edit screens so I can perform custom validation on the fields content.

3 Likes

No matter how it changes or updates, MVC structure is the main skeleton.
Pages----(Ajax)-----Actions/Servlet/REST-----(DB)-----Pages.

Thanks but I am still not sure.

I understand how to deploy pages and use them to update content, but what I am not sure if how to override the field rendering for a custom field in the Atlassian Connect SDK.

When I have done this before, I have deployed a Velocity Template within a plugin for the rendering. Now I am wondering if I can use an Issue Field Template (https://developer.atlassian.com/static/connect/docs/beta/modules/fragment/issue-field-template.html) and if so, how should this page be constructed.

I am comfortable building pages in JIRA but just not sure how to just overridge the rending of a new customer single-select field.

Does that make sense?

I remember there is something similar introduced in the cookbook. Or maybe you can download some examples from marketplace.

HI @david1,

We don’t support overriding the rendering of issue fields. They use JIRA’s default rendering based on the type you specify.

If you really need to validate values, the current options are to either use a single-select type and dynamically provide options, or you can implement your own UI using a web panel and issue entity properties. However, the latter will only be available on the View Issue screen, not create and edit. However, many add-ons have found success adopting either of these two routes.

Dave

Thanks @dmeyer. That confirms this once and for all then.

How would one dynamically provide options? Update them via the API? Or is there another way too look these up on the fly?

The reason I ask as our values change frequently.

Thanks,
David

Hi @david1,

That’s correct. We provide a REST API specifically for updating the options for issue fields: https://docs.atlassian.com/jira/REST/cloud/#api/2/field/{fieldKey}/option

While we certainly understand why you would want to look the values up on the fly, having the values locally in JIRA makes everything more resilient to network problems, etc.

Dave

Hi @dmeyer,

I am confused. The developer documentation at https://developer.atlassian.com/cloud/jira/platform/modules/issue-field/ still states that it’s possible to specify a template when the type is single_select or multi_select.

Does it mean the documentation is incorrect?

Thanks!

Hi @guw,

The template option as described in the Issue Fields documentation allows you to render Issue Field string options as links, as described here: Issue Field Template

What do you think is incorrect?

I think it wasn’t that clear. From looking at the doc, I just saw template. Thus I was implying that it’s still possible to supply a template for rending the options. However, with the additional information/context you provided and a second read, it becomes clear that type can only ever be link, which also requires the url property.

Maybe the documentation should be enhanced with an example and some additional wording that those templates only allow url/link style rendering?

Sorry, I know this is a massive necro, but I came to the same (wrong) conclusion 2 years later. I thought this would hit an endpoint on the Connect server which could return back some HTML to customise the rendering of the options, not let us provide a link.

Plus the templates don’t actually work in the new issue view.

Same misunderstanding on template, but i’m still wondering how to retrieve data from my backend, BTW, i’m using a rest api backend, and a general react project, just use connect.json file to link to the page