It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How do I dynamically generate a customer portal issue link?

Fred Gruhn Apr 28, 2017


I'm using ScriptRunner to create a custom email based on a transition postfunction. 

In the email, I want to generate the URL for the Service Desk customer portal URL for the issue. For example, I want to dynamically generate:

When I append ${issue.key} to the end of the above (ending with portal/5/). I recevie an error when trying to access it from the email. 

How can I discern (via ScriptRunner Groovy script) what numeric value needs to come aftrer /portal/? 

1 answer

1 vote
Thanos Batagiannis [Adaptavist] Community Leader May 12, 2017

Hi Fred, 

In order to get the portal id via the service desk api use the below script

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.servicedesk.api.ServiceDeskManager
import com.onresolve.scriptrunner.runner.customisers.PluginModule
import com.onresolve.scriptrunner.runner.customisers.WithPlugin


ServiceDeskManager serviceDeskManager

def project = ComponentAccessor.getProjectManager().getProjectByCurrentKey("TB")
def portalId = serviceDeskManager.getServiceDeskForProject(project).right().get().id

Let me know if this does the trick.

regards Thanos

Fred Gruhn May 12, 2017


Thanks for the reply. When I paste your submission into the "Condition and Configuration" script window for the Custom Email page, I get the following error on line 12 (last line of your submission): 

[Static type checking] - no such property: id for class: R @ line 12, column 16. 

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Marketplace Apps & Integrations

Join our webinar: “Asset Management: The Role of Context in ITSM” with Atlassian & Riada

  Hi Atlassian Community! This is Teresa from the Jira Service Desk team. On June 19th, I’ll be hosting a webinar “Asset Management: The Role of Context in ITSM” with Atlassian Partne...

177 views 2 3
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you