Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Access URL in customer portal

Kai Krause August 8, 2022

I have the following issue.

I'm trying to display a notice on the creation page of a case in the customer portal.

I try this with a Scriptrunner web panel

<code>

import com.atlassian.jira.plugin.webfragment.model.JiraHelper import com.atlassian.jira.component.ComponentAccessor import com.atlassian.servicedesk.api.requesttype.RequestTypeService import com.onresolve.scriptrunner.runner.customisers.WithPlugin @WithPlugin("com.atlassian.servicedesk") def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser() def requestTypeService = ComponentAccessor.getOSGiComponentInstanceOfType(RequestTypeService) def query = requestTypeService.newQueryBuilder().serviceDesk(7).requestType(137).build() def reqT = requestTypeService.getRequestTypes(currentUser,query) def requestType = requestTypeService.getRequestTypes(currentUser, query).results def name = requestType.name writer.write( '''<style> label#attachment-label.field-label::after { content: "MyText"; background-color:#fff7e0; color:black; font-family: Arial, Helvetica, sans-serif; } </style> ''' )

</code>

I want to resolve in this line requestTypeService.newQueryBuilder().serviceDesk(7).requestType(137).build() and set the serviceDesk and the requestType from the Url of the creation. But I can't access it. How can i get the url ?

1 answer

0 votes
PD Sheehan
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.
August 21, 2022

You can access the request type directly from the binding variable "context".


writer.write(
"requestTypeId=$context.requestTypeId<br>")
writer.write("requestTypeName=$context.requestType.name<br>")

So you can dispense with the query altogether

You can always examine what else might be available to you by outputting some details

writer.write("otherBindingVairable=${binding.variables.keySet()}<br>")
writer.write("otherContextKeys=${context.keySet()}<br>")

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, jira cloud certification, managing jira projects, jira project administration, jira cloud exam, atlassian certification, agile project management, jira workflows, jira permissions, jira training, jira cloud skills, atlassian learning

Become a Certified Jira Service Project Expert 🦸🏻‍♂️

Validate your expertise in managing Jira Service Projects for Cloud. Master configuration, optimize workflows, and manage users seamlessly. Earn global 🗺️ recognition and advance your career as a trusted Jira Service management expert.

Get Certified! ✍️
AUG Leaders

Atlassian Community Events