Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.
×@Steven Behnke
Hello Steve...As you ask I've created the topic on Atlassian answers.
So, may be you can help me. As we know Service Desk is not mature and we have to create somme tools with allow to create correct issue linked with the ticket and to floww their transitions
If you want to create an issue link in service desk you have to use their create linked issue dialog...but it is not operationnal...very limited.
So I asked to adaptavist support who told me that internally they don't use this "create linked dialog" because it's so limiting, instead they use https://scriptrunner.adaptavist.com/latest/jira/fragments/CreateConstrainedIssue.html with a behaviour that copies whatever fields we want from the linked issue.
And it works...but you can't change the project type or the issue type in the dialog box...So I had to create as many buttons as need in the menu "More" of the issue. Too bad. I've asked to the adaptavist support...I'm waiting their respond.
My second problem is to be able to put a comment in the parent issue (Service Desk) and to transition it to resolve when the linked issue is closed. Unfortunatly the automation system in Service Desk doesn't work...so they've created a bug for me (JSD-4357) witch will be fixed in the 3.3.0 version.
So I've decided to search how doing it...and I've created Adds a comment to linked issues when this issue is transitioned poste function in my workflow...It works but for all my project...I would like to put a comment in the linked issue only if this type is Service Desk
QUESTION 1 : According to you is it possible when a issue is transitionned to status closed :
If you can help me Steven...it will be great
Best regards, Olivier
> And it works...but you can't change the project type or the issue type in the dialog box...
We use a velocity context handler that chooses the right dev project for the support project. But if you have many different choices for the project, we can't really handle that, other than create the issue in the wrong project then move it.
We set up the "create issue" link using "raw xml module":
<web-item key='create-bug-for-ticket' name='ScriptRunner generated web item - create-bug-for-ticket' section='operations-operations' weight='1'> <label>Create Linked Bug</label> <condition class='examples/jsd/IsScriptRunnerSupportProject.groovy' /> <styleClass>sr-create-bound-issue</styleClass> <context-provider class="examples/jsd/DevProjectContextProvider.groovy" /> <link linkId='create-bug-for-ticket'>/secure/CreateIssue.jspa?pid=$devProjectId&amp;issuetype=1</link> </web-item>
You get most of that from running Preview on the "constrained create issue".
Then teh context-provider code is:
package examples.jsd import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.plugin.webfragment.contextproviders.AbstractJiraContextProvider import com.atlassian.jira.plugin.webfragment.model.JiraHelper import com.atlassian.jira.project.ProjectManager import com.atlassian.jira.user.ApplicationUser import groovy.util.logging.Log4j @Log4j class DevProjectContextProvider extends AbstractJiraContextProvider { ProjectManager projectManager = ComponentAccessor.getProjectManager() public static final Map<String,String> SUPPORT_TO_DEV = [ "SRJSUP" : "SRJIRA", "SRCONF" : "SRCONFSUP", "SRBSUP" : "SRBITB", "SRTESTSUP": "SRTESTDEV", ] @Override Map getContextMap(ApplicationUser user, JiraHelper jiraHelper) { def project = jiraHelper.getProject() def devProjectId = null if (project) { def devProjectKey = SUPPORT_TO_DEV[project.key] if (devProjectKey) { devProjectId = projectManager.getProjectObjByKey(devProjectKey)?.id } else { log.warn("Create linked issue applied to project we don't know about: ${project.key}") } } ["devProjectId": devProjectId] } }
<web-item key='create-bug-for-ticket' name='ScriptRunner generated web item - create-bug-for-ticket' section='operations-operations' weight='1'> <label>Create Linked Bug</label> <condition class='examples/jsd/IsScriptRunnerSupportProject.groovy' /> <styleClass>sr-create-bound-issue</styleClass> <context-provider class="examples/jsd/DevProjectContextProvider.groovy" /> <link linkId='create-bug-for-ticket'>/secure/CreateIssue.jspa?pid=$devProjectId&issuetype=1</link></web-item>
Issue issue = params['issue'] as Issue String linkTypeStr = params[FIELD_LINK_TYPE] as String String commentTemplate = params[FIELD_COMMENT] as String String linkTypeId = "" String linkDirection = "" (linkTypeId, linkDirection) = linkTypeStr.split(/ /) as List IssueLinkManager linkMgr = ComponentAccessor.getIssueLinkManager() CommentManager commentManager = ComponentAccessor.getCommentManager() def currentUser = WorkflowUtils.getUser(params) List links = [] if (linkDirection == CannedScriptUtils.OUTWARD_FIELD_NAME) { links = linkMgr.getOutwardLinks(issue.id) } else if (linkDirection == CannedScriptUtils.INWARD_FIELD_NAME) { links = linkMgr.getInwardLinks(issue.id) } links.each {IssueLink link -> if (link.getLinkTypeId() == linkTypeId as Long) { Issue destIssue = linkDirection == CannedScriptUtils.OUTWARD_FIELD_NAME ? link.getDestinationObject() : link.getSourceObject() Writable template = WorkflowUtils.mergeTemplate(params, commentTemplate) log.info ("Create comment on ${destIssue.key}") def userUtil = ComponentAccessor.getUserUtil() if (! currentUser) { log.warn ("Cannot create a comment for anonymous user") return } def appUser = userUtil.getUserByName(currentUser.getName()) commentManager.create(destIssue, appUser, template.toString(), true) } } [:]
so you can just use that but add a condition.
Stupid question, but where/how do I add the "context-provider code"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You just need to put that into one of your script roots directories. By default, there's one in $JIRA_HOME/scripts. Make sure to put it in the appropriate packages based on the package declaration at the top. So, for the linked example, the directory would be $JIRA_HOME/scripts/examples/jsd/.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Olivier,
I assume you are on server and not cloud. I know that on cloud this is possible via Automation as I do this today, or something very similar. In brief my solution is this.
Scenario: Product issue come in thru my IT helpdesk and I want to alert/track the product issue in JSW while maintaining the original JSD issue, linking the two.
Solution:
I'm surprised that the server versions would not support this and it would be unfortunate.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Oh wow! It looks like the @mention didn't work, I'm sorry I never found this. I was searching around and I was a little shocked to see my name at the top. I'm glad you got your answer.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Oliver,
yes my automation only transitions a linked issue not create an issue. While I have not researched that specifically, I do not believe JSD Automation will meet that need. My agents manually create and move the linked issues.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Jack Brickey
Hello Jack,
When I read your automation I understand that your trigger is when the linked issue is transitionned, when its status is changed. I'm allright ?
According to you is it possible to triggerring the automation when the the linked issue is created ? Because this is I would like to do...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
image2016-11-7 9:50:59.png
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.