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 ?
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>")
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.