Adding custom script for custom field in Service Desk to validate value

Hi,

I created a custom field in Service Desk. My customer will insert some unique value in this field while creating a ticket in service desk.

I want to add custom script for this custom field. I will use this field to verify its value through a 3rd party API. I have the code but I don't know where to add this custom script for the custom field.


<script>
$(document).on('click', '.aui-button.aui-button-primary', function (e) {
$.ajax({
url: API_URL
dataType: "json",
method: 'post',
data: {
'action': ENVATO_API,
'value': API_KEY
},
success: function (data) {
if (data.success) {
return true;
} else {
return false;
console.log('Invalid envato key')
}
},
error: function (errorThrown) {
console.log(errorThrown);
}
});
})
</script>

1 answer

1 vote
Alexey Matveev Community Champion Jan 05, 2018

Hello,

I think you should use Adaptivist ScriptRunner.  There are behaviours for customer portals. You will be able to attach such a behaviour to your field  and do rest calls within the behaviour. You can find more information here

https://scriptrunner.adaptavist.com/latest/jira/behaviours-servicedesk.html#_example

Hi,

I think I need to install the behaviours plugin but it seems like it's not available for cloud Jira. It's only available for hosted Jira.

If so is there any other way to accomplish my goal?

Thanks

Alexey Matveev Community Champion Jan 05, 2018

It is impossible to add custom javascript to Cloud. I guess you can not accomplish what you want to do.

Thank you for quick response.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Mar 09, 2018 in Jira Service Desk

E.L. Fridge's take on education, Jira Service Desk, and creative Jira use cases

...word of mouth, so by 2016, we were working with several other entities on campus to implement Jira Service Desk . The Atlassian motto of “for every team” has really come true for us in this case. We...

971 views 2 14
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