Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,360,098
Community Members
 
Community Events
168
Community Groups

Access URL in customer portal

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

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
Community showcase
Published in Jira Service Management

An unofficial way to monitor a JSM mail handler for errors

...eturns true if any content is returned for the webResponse.body.data.first s...

668 views 3 20
Read article

Atlassian Community Events