Javascript and Behaviours scripts in Jira Service Desk Forms

Vidic Florjan
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.
October 6, 2013

I noticed that Jira Service Desk has a new GUI and that is not possible to use javascript code added in field description. It is also not possible to use Behaviours plugin scripts in the new forms.

I would like to find out if our jira has problems or this is normal behaviour of the new forms.

If javascript in description of the field is not supported anymore:

- Are there any plans to add this functionality?

- Is possible to use some workarounds (or different approach)?


Jira version: 5.2.2
Behaviours: 0.5.3

Javascript example:

<script>
function getCurrentUserName_sr()
{
var user;
AJS.$.ajax({
url: "/rest/gadget/1.0/currentUser",
type: 'get',
dataType: 'json',
async: false,
success: function(data) {
user = data.username;
} 
});
return user;
}
var user = getCurrentUserName_sr();
AJS.$("#customfield_13421").val(user);
</script>

0.5.3

6 answers

1 accepted

7 votes
Answer accepted
ɹǝʞɐq pɐɹq
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 7, 2013

We dont have immediate concrete plans to add "custom custom" fields in the Service Desk customer view.

At present we have a "peer" field implementation for every JIRA custom field we know about. We did this to provide a fast and light weight end user experience. Our aim was that the customer view should load fast and suporrt key concepts like "field renaming" and modern "UI representation".

If we re-used the custom custom field implementations as is, we would have rebuilt JIRA view issue and its heavy weight design aspects. This is a key differentiator between create issue in JIRA and create issue in Service Desk.

There is another security aspect as well. Currently a project admin is able to create Service Desk "customer view" fields. By allowing custom JavaScript via this mechanism, we would be lowering the security of "custom javascript" from sysadmin (plugin install) to project admin. We do not want this to happen.

It is something we have thought about however and its a non trivial problem.

Some time in the future we have though of having a "plugin point" where "custom field" implementations could inject Service Desk specific JS/CSS as an alternate rendering on the customer view. But this is not on a concrete internal roadmap at this time.

Thanks for asking and providing extra feedback.

Cheers

Brad Baker

JIRA Service Desk Architect

Vidic Florjan
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.
October 8, 2013

Thank you for detailed explanation.

Cheeers
Florjan Vidic

1 vote
Tim C October 31, 2013

I also too would like to know if there is any possible way of showing certain fields when other fields have specific inputed information. Since there currently is no public API for the Service Desk is there another way?

1 vote
Chad Michael
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 30, 2013

Is there any way with Jira Service Desk to get a field to display as input type='password'? We have users entering information at a kiosk and there are some fields that we need to be stars when they type so passerby's can't see it.

1 vote
RambanamP
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.
October 7, 2013

If javascript in description of the field is not supported anymore:

if you add javascript in field description it will work in all screens except in create screen(in create screen also work without project/issuetype change on popup)

the simple way is you can load it as webreosurce module in javascript.

check this doc

https://developer.atlassian.com/display/JIRADEV/Custom+Fields+that+use+CSS+or+JavaScript+Web+Resources+in+JIRA+5.0

and also check this

https://answers.atlassian.com/questions/47843/strange-javascript-problem-in-create-screen

gdavidson
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.
October 10, 2013

That method won't work for the Service Desk customer portal, however, as it's a separate rendering context from normal JIRA.

Nitram
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.
April 29, 2014

Hi,

Is there any work around for this issue, cause I need to have a dynamic form based on the custom field values in the service desk.Thanks for your help in advance!

Saarvaani Vadlamani
Contributor
January 24, 2017

@Nitram I am looking for similar functionality. Were you able to get this working?

0 votes
Nitram
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.
April 29, 2014

Hi,

Is there any work around for this issue, cause I need to have a dynamic form based on the custom field values in the service desk.Thanks for your help in advance!

0 votes
JBarr
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 22, 2013

What about the use of dynamic forms instead. I know it's not free, but there has to be some way to make contingent forms on the service desk or else it is just not as useful.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events