Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

JavaScript or Redirect in Customer Portal

Josh Parrish September 23, 2016

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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

2 votes
mina
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 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.

Josh Parrish September 25, 2016

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
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 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

Josh Parrish September 25, 2016

Thank you! I will give this a try!

Cole
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.
September 26, 2016

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
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 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.

Khuong Vu March 13, 2017

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.  

 

0 votes
Avinash Singh August 2, 2018

Hi @mina

Can you confirm that this functionality is now available ?

mina
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 2, 2018

Yes, it is.

Valéria Cruz August 30, 2018

how to I use this??

TAGS
AUG Leaders

Atlassian Community Events