Dear Experts,
My scenario is
Till here i am done and its working.
I am using script runner rest end point and javascript to get the value from if they said yes.
I have a groovy method which is updating the field after receiving the key.
I am stuck here how to proceed further, how can i execute the groovy method inside the javascript, once user said proceed.
Hi @Muhammad Ramzan(Atlassian Certified Master)
I have a groovy method which is updating the field after receiving the key.
Is this groovy method available as a rest endpoint?
If so, you could make an ajax call from your dialog box javascript to that rest endpoint and provide the issue key as a parameter.
Here is a recap of scriptunner configuration you will likely need:
@Dear @Peter-Dave Sheehan , many thanks for the solution. I found the solution and did the same as you suggested here. Its working like a champ. many thanks,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
we have a similar challange. We are able to fill the fields back from dialog to Jira, but we struggle to make an Issue.Update Event.
May your share how you solved it`?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You should not have to raise an event manually.
There are 3 ways I'm aware of for updating fields (in order of recommended preference)
If you use the first 2, you can specify to raise an IssueUpdated event.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
we checkd out everything, won't work.
Here is our Rest EndPoint Relay:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try this:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.index.IssueIndexingService
import com.atlassian.jira.util.ImportUtils
import com.onresolve.scriptrunner.runner.rest.common.CustomEndpointDelegate
import groovy.json.JsonSlurper
import groovy.transform.BaseScript
import javax.ws.rs.core.MultivaluedMap
import javax.ws.rs.core.Response
@BaseScript CustomEndpointDelegate delegate
String issueKey = null
String BuildStatusValue = null
BuildStatusRelay(httpMethod: "POST") { MultivaluedMap queryParams, String payload ->
def jsonSlurper = new JsonSlurper()
def content = jsonSlurper.parseText(payload)
issueKey = content.key
BuildStatusValue = content.body
def im = ComponentAccessor.issueManager
MutableIssue issue = im.getIssueObject(issueKey)
def user = ComponentAccessor.getUserManager().getUserByName("kdomschk")
def cfm = ComponentAccessor.getCustomFieldManager()
def customField = cfm.getCustomFieldObject(24970)
issue.setCustomFieldValue(customField, BuildStatusValue)
im.updateIssue(user, issue, EventDispatchOption.ISSUE_UPDATED, false)
def issueIndexingService = ComponentAccessor.getComponent(IssueIndexingService)
Boolean wasIndexing = ImportUtils.indexIssues
ImportUtils.indexIssues = true
issueIndexingService.reIndex(issue)
ImportUtils.indexIssues = wasIndexing
Response.ok(payload).build()
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.