Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
Level
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Groovy Script postfunction Function

Hola a todos.

Necesito asignar una tarea de un proyecto a un usuario a través de un  Groovy Script postfunction Function, pero no me está funcionando. Adjunto el script que estoy usando.

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.MutableIssue
String userName;
def customFieldManagerPackges = ComponentAccessor.getCustomFieldManager()
def cFieldPackges = customFieldManagerPackges.getCustomFieldObject("customfield_12001")
def cFieldValuePackges = issue.getCustomFieldValue(cFieldPackges)

switch(cFieldValuePackges){
case "traful_dev_users": userName = "wuedva07";break;
case "traful_infra_users": userName = "wuedva07";break;
}

issue.setAssignee(ComponentAccessor.getUserManager().getUserByName(userName));

1 answer

1 accepted

Hola,

Puede seguir el siguiente ejemplo. Debería funcionar para ti.

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.user.util.UserManager

def issueManager = ComponentAccessor.issueManager
def mutableIssue = issue as MutableIssue

def
customFieldManagerPackges = ComponentAccessor.getCustomFieldManager()
def cFieldPackges = customFieldManagerPackges.getCustomFieldObject("customfield_12001")
def cFieldValuePackges = issue.getCustomFieldValue(cFieldPackges)

String
selectedUser;

//Get current logged-in user for issue update after setting the assignee
ApplicationUser user = ComponentAccessor.jiraAuthenticationContext.loggedInUser

switch
(cFieldValuePackges) {
case "traful_dev_users":
selectedUser
= "wuedva07";
break;

case
"traful_infra_users":
selectedUser
= "wuedva07";
break;
}

//Set assignee & update issue
UserManager userMgr = ComponentAccessor.getUserManager()
ApplicationUser userName = userMgr.getUserByName(selectedUser)

issue
.setAssignee(userName)
issueManager.updateIssue(user, issue, EventDispatchOption.DO_NOT_DISPATCH, false)

Espero que esta información te ayude!

Sí está respuesta respondió a su pregunta, por favor márquela como la respuesta aceptada.

Hello Winnie Koh,

I need to create a new field called and automate a process, which I will explain below.

1. Let him check the type of problem.
2. Check the value of the "Epic Link" field for that issue.
3. Add that value to the new created field.
4. And in case it is a subtask problem, find the value of the "Epic link" field of the parent task of that subtask and add it to the new field of that subtask ... since as you well know, that field " Epica Link "does not appear in subtasks.

I have thought with MyGroovy but I have never done it, I do not know if they could give me a hand.

Thanks in advance.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Site Admin
TAGS
Community showcase
Published in Marketplace Apps & Integrations

New Cloud Apps Roundup - Spring 2021

Atlassian's marketplace partners have had a very productive start to 2021! Since our last roundup, our developer community has added over 160 new cloud apps to the Atlassian Marketplace to help you...

192 views 3 19
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you