Behaviour on Jira Service Desk portal for Asset fields

Stefan Stadler
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 23, 2025

Hi all,

I realized some problem and wanted to confirm if you can see this as well.

I have setup a Service Desk test page, where I have added the following fields:

- Priority

- a select field

- an Asset custom field for selecting objects

The same custom script code is applied to all 3 fields for validation. For Priority and the select field, it is working fine.

The plan is to use the Asset object for manipulating the UI and for example providing a template text in the description. However, it appears the behaviour is not even triggered for Asset custom fields when the value changes. It is only triggered once the page is reloaded (and yes, this is not added in the initialiser section ;) )

Is there some kind of limitation, that the behaviours are only triggered on page reload for Asset custom fields on Jira Service Desk request type pages? 

I am already using this within plain Jira and there it is working without any issues.

Do you have any idea, if there is something missing in the SD Portal pages for behaviours to be working with Asset fields?

Thanks for your help!

Stefan

 

1 answer

1 vote
Ram Kumar Aravindakshan _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 26, 2025

Hi @Stefan Stadler

Could you please share the Behaviour code you are using for the Asset field so I can review it and provide some feedback?

Also, please clarify: How are you invoking the value of the Asset field? Are you using ScriptRunner's HAPI feature?

When using the Asset field, if you are directly trying to passe the value of the Asset field, it will not work as the Asset field will pass the Asset's key. Certain filtration needs to be done for it to work as expected.

I am looking forward to your feedback and clarification.

Thank you and Kind regards,
Ram

Stefan Stadler
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 27, 2025

Hi @Ram Kumar Aravindakshan _Adaptavist_ 

thanks for your reply.

I do already know, how to work with the Asset custom fields in behaviours outside of the JSM portal. We already use it a lot within Jira Software.

The script code is very simple for testing purposes and does not have anything to do with value handling of Asset fields.

getFieldByName('Description').setRequired(getFieldById(getFieldChanged()).value?true:false)
So the idea is to set the description field to required if there is a value set, otherwise set it to optional.
From the browser development tools, I can see that the behaviour is not executed at all and that also matches with the viewable result of nothing happening at all.
Do you have an explanation for that?
Thanks!
Stefan
Ram Kumar Aravindakshan _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 27, 2025

Hi @Stefan Stadler

In your last comment, you mentioned:-

So the idea is to set the description field to required if there is a value set, otherwise set it to optional.

Please clarify: When you say "there is a value set", are you referring to when there is a value set in the Asset field?

I am looking forward to your feedback and clarification.

Thank you and Kind regards,

Ram

 

Stefan Stadler
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 27, 2025

Hi @Ram Kumar Aravindakshan _Adaptavist_ 

"there is a value set" simply means, that the user selects one object in the Assets field.

I do not fetch any attribute on the object, it is really mean like "does this custom field has a value set or is it empty".

As I said, this is only for demonstration, but it already shows that the behaviour is not executed for Asset custom fields in the portal.

Regards,

Stefan

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
9.4.1
TAGS
AUG Leaders

Atlassian Community Events