Hi,
I have an 2 Issue Types(unplanned and SI ) and Two workflows for each issue type i have assigned each workflow. so, here is thing in Unplanned workflow I just created 2 transitions (Contain & Re-Open ), Status(Containment and Complete).
So when I click on Contain transition it goes to Complete Status after going to that stage I Want to create automatically an another ticket With SI Issue type, and in the issue screen the costume fields like (Linked Issue: relates to) and Link custom field : the unplanned ticket should be created before and i have an word document Attachment custom Filed that word document should be assign automatically.
Is there any way to do like this???? if it is please let me know...
Thanks,
Phani
There's no way to do this out of the box. You should be able to do this using the Create/Clone issue post-function from the JMWE for Jira Server app.
I saw you tagged this with a ScriptRunner label, and this is totally possible to do using a scripted post-function. I don't have any code handy to share, but this or this might be a good starting place to help build a script for that. I'd recommend the first option I mentioned though - it's MUCH easier than trying to write a script for that.
Hi @Alex Christensen In Unplanned issue workflow for "Contain transition" post-function i run a script its createing the new SI ticket . So after creating the new ticket in that ticket screen it ha to view automatically which ticket it relates to. The two costume field should be automatically view (Linked issue: relates-to and Link: the Unplanned ticket ). can you please suggest me those two custom fields automatically
After Creating the SI ticket in that ticket this field should be displayed automatically as I shown in the photo
Here is the query that i have run in the post-function this will create only the ticket :
import com.atlassian.jira.component.ComponentAccessor
def issueService = ComponentAccessor.issueService
def projectManager = ComponentAccessor.projectManager
def user = ComponentAccessor.jiraAuthenticationContext.getLoggedInUser()
def issueInputParameters = issueService.newIssueInputParameters()
issueInputParameters.with {
projectId = projectManager.getProjectObjByKey("JIR").id
summary = "Issue created from script"
issueTypeId = "1"
reporterId = user.name
}
def validationResult = issueService.validateCreate(user, issueInputParameters)
assert !validationResult.errorCollection.hasAnyErrors()
def issueResult = issueService.create(user, validationResult)
log.info "Issue created: ${issueResult.issue}"
Thanks,
Phani
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You're definitely on the right track. I would also check out the createIssueLink() method under the IssueLinkManager class. You should be able to add some additional code at the end of your script once you create the issue to link from the current issue to the new one you just created.
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.
@Kumar, the code should look something like this. You'll need to change the link ID to whatever link type you want to use in your instance.
import com.atlassian.jira.component.ComponentAccessor
def issueService = ComponentAccessor.issueService
def projectManager = ComponentAccessor.projectManager
def user = ComponentAccessor.jiraAuthenticationContext.getLoggedInUser()
def issueInputParameters = issueService.newIssueInputParameters()
issueInputParameters.with {
projectId = projectManager.getProjectObjByKey("JIR").id
summary = "Issue created from script"
issueTypeId = "1"
reporterId = user.name
}
def validationResult = issueService.validateCreate(user, issueInputParameters)
assert !validationResult.errorCollection.hasAnyErrors()
def issueResult = issueService.create(user, validationResult)
log.info "Issue created: ${issueResult.issue}"
// create issue link - change the "11010" to the link id
def issueLinkManager = ComponentAccessor.getIssueLinkManager()
issueLinkManager.createIssueLink(issue.getId(), issueResult.getIssue().getId(), 11010, 1, user)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Alex Christensen Thanks You much for you response. And I have tried an new thing instead of running a query in post-function.
For Contain Transition I have add post-function -->script postfunction-->Clone an issue and links-->In that Target project (I have selected that i'm working on) ---> Target Issue type( I have selected issue type what I want to create automatically) ---->Issue Link Type / Direction( I selected "Relates to") and the I add that post-function to that Contain transition.
Now, what exactly its doing means if "Contain" the ticket it will closed and there its self it will show you the new Ticket is created like this as shown below screenshort
this new ticket will automatically view on you screen when the ticked is closed.
and if you open the new ticket it will show you the closed ticket as shown below
.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.