JavaScript or Redirect in Customer Portal

Hello!

We are running JIRA Server and are wondering if there is a way to implement any sort of JavaScript or redirect in the customer portal through customization? We would like to have a few categories with the customer portal that would link to an internal service page. For example, we would like to have a "Request Hardware" request type in the customer portal and have that redirect to an internal web page instead of transitioning to the next ticket creation screen.

Thanks,

Josh

2 answers

2 votes
Mina Samy Atlassian Team Sep 25, 2016

Hi Josh

Official support for this is coming with JIRA Service Desk 3.2.2, so keep an eye out for that.

Once you are on that version you can use the "servicedesk.portal" context to include your JS resources on the customer portal.

Until then though, you can use the "customerportal" context. Note however that this context is NOT public API and is subject to change without notice. So please make sure to migrate to the new context when you upgrade to 3.2.2.

Hi Mina!

Sorry for all the questions but i am still a beginner in this! Where exactly would the "customerportal" context be included at?

Thanks!

Mina Samy Atlassian Team Sep 25, 2016

It is probably a good idea to have a read of this guide: https://developer.atlassian.com/display/jiradev/web+resource+plugin+module

Thank you! I will give this a try!

Hi Mina,

I looked at the link you provided and I am wondering where I should put these files. I created an xml file called "atlassian-plugin.xml" and a "portal.js". They both live in the JIRA conf folder with the context.xml. Is this the correct location? I also am unsure if my file is written with 100% correct syntax. Could you provide some feedback?

 

atlassian-plugin.xml:

<web-resource name="Resources" key="resources">
        <resource name="portal.js" type="download" location="portal.js">
        </resource>
		
        <context>
		customerportal
		</context>
		
</web-resource>

 

portal.js:

$(document).ready(function() {
            if(window.location == "https://jiratest.domain.com/servicedesk/customer/portal/1/create/83") {window.location.href = "https://redirecturlcom"}
            if(window.location == "https://jiratest.domain.com/servicedesk/customer/portal/1/create/82") {window.location.href = "https://redirecturl.com"}
});
Mina Samy Atlassian Team Sep 28, 2016

Your syntax looks fine. You will see errors in the JS console or in the logs if the file could not be found so look out for that. Otherwise, this should work.

Hi Mina and All,

First, Mina is right about using "servicedesk.portal" in version 3.2 or later.  I am actually on version 3.3.  "customerportal" was working for me in v.3.1 but not in 3.3, Thank you Mina.

Second, when I use "servicedesk.portal" with my web resource plugin, it did not seem to work at first.  That is because my CSS file did not do anything to the customer portal.  Upon closer examination, my CSS file is being referenced inside the long string after href on line  <llink type="text/css" ...> (which you can see when you view source on your customer portal).

&lt;link type="text/css" rel="stylesheet" href="/s/a7387e755408613702b3f3cac7d758b0-CDN/8m41i3/73011/9024b0dd00a69c0253ae96d6c4be3e3a/932c0d13fddb474b73c48c5dc1a2fa31/a613160711a9716e35f7bb8b50648201/_/download/contextbatch/css/customerportal,servicedesk.portal/batch.css?sd_operational=true" data-wrm-key="customerportal,servicedesk.portal" data-wrm-batch-type="context" media="all"&gt;

But, my CSS file is at the very bottom of the external link.  What makes it worse is that my CSS file is a simple line @import url ('https://www.example.com');  and it many not load.  When I replace the import directive with the actual content of my CSS file, it works.  

 

Hi @Mina Samy

Can you confirm that this functionality is now available ?

Mina Samy Atlassian Team Aug 02, 2018

Yes, it is.

how to I use this??

Suggest an answer

Log in or Sign up to answer
Community showcase
Published yesterday in Agile

Are you a Jira Service Desk agent? We want to talk to you!

Are you a whiz at handling tickets and looking at how you can further optimize your workflow with automation? Do you tackle detailed customer support questions while simultaneously getting flooded wi...

26 views 0 2
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