Javascript and Behaviours scripts in Jira Service Desk Forms

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

Accepted Answer
6 votes
Brad Baker Atlassian Team Oct 07, 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

Thank you for detailed explanation.

Cheeers
Florjan Vidic

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

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

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!

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

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.

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?

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.

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!

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Aug 13, 2018 in Jira Service Desk

Jira Service Desk – Don’t be afraid, the journey begins with curiosity!

...be more productive while being fun to use at the same time. For some, getting started can be a bit intimidating. This is especially true if Jira Service Desk is your first exposure to Atlassian...

18,505 views 13 31
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you