I have the asset details captured such as CPU, OS, Network Interface, File Systems, but I want license details.
Your if clauses should look like this:
if (issue.getCustomFieldValue(e2e).toString() == "Value 1" && issue.getCustomFieldValue(dep).toString() == "Value A"){
and at the end of the scripts there must be
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
ComponentAccessor.getIssueManager().updateIssue(user, issue, EventDispatchOption.ISSUE_UPDATED, false)
Tried it like this, but did'nt work. My script runs with no errors, but the issue is still UNASSIGNED after the transition. Any idea?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is what works now. Thanks Alex!
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.user.ApplicationUsers
import com.atlassian.jira.event.type.EventDispatchOption
import static com.atlassian.jira.issue.IssueFieldConstants.ASSIGNEE
MutableIssue issue = issue;
String userName;
def e2e = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("E2E process (main)")
def dep = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("IT department")
String assGroup;
if (issue.getCustomFieldValue(e2e).toString() == "Process 1" && issue.getCustomFieldValue(dep).toString() == "Department Value 1"){
assGroup = "1"
} else if (issue.getCustomFieldValue(e2e).toString() == "Process 2" && issue.getCustomFieldValue(dep).toString() == "Department Value 1"){
assGroup = "2"
} else if (issue.getCustomFieldValue(e2e).toString() == "Process 3" && issue.getCustomFieldValue(dep).toString() == "Department Value 1"){
assGroup = "3"
} else if (issue.getCustomFieldValue(e2e).toString() == "Process 4" && issue.getCustomFieldValue(dep).toString() == "Department Value 2"){
assGroup = "4"
} else if (issue.getCustomFieldValue(e2e).toString() == "Process 5" && issue.getCustomFieldValue(dep).toString() == "Department Value 2"){
assGroup = "5"
} else if (issue.getCustomFieldValue(e2e).toString() == "Process 6" && issue.getCustomFieldValue(dep).toString() == "Department Value 2"){
assGroup = "6"
} else if (issue.getCustomFieldValue(e2e).toString() == "Process 7" && issue.getCustomFieldValue(dep).toString() == "Department Value 3"){
assGroup = "7"
} else if (issue.getCustomFieldValue(e2e).toString() == "Process 8" && issue.getCustomFieldValue(dep).toString() == "Department Value 3"){
assGroup = "8"
} else if (issue.getCustomFieldValue(e2e).toString() == "Process 9" && issue.getCustomFieldValue(dep).toString() == "Department Value 3"){
assGroup = "9"
} else if (issue.getCustomFieldValue(e2e).toString() == "Process 10" && issue.getCustomFieldValue(dep).toString() == "Department Value 3"){
assGroup = "10"
} else if (issue.getCustomFieldValue(e2e).toString() == "Process 11" && issue.getCustomFieldValue(dep).toString() == "Department Value 4"){
assGroup = "11"
} else if (issue.getCustomFieldValue(e2e).toString() == "Process 12" && issue.getCustomFieldValue(dep).toString() == "Department Value 5"){
assGroup = "12"
} else if (issue.getCustomFieldValue(e2e).toString() == "Process 13" && issue.getCustomFieldValue(dep).toString() == "Department Value 6"){
assGroup = "13"
} else if (issue.getCustomFieldValue(e2e).toString() == "Process 14" && issue.getCustomFieldValue(dep).toString() == "Department Value 7"){
assGroup = "14"
} else if (issue.getCustomFieldValue(e2e).toString() == "Process 15" && issue.getCustomFieldValue(dep).toString() == "Department Value 8"){
assGroup = "15"
}else if (issue.getCustomFieldValue(e2e).toString() == "Process 16" && issue.getCustomFieldValue(dep).toString() == "Department Value 9"){
assGroup = "16"
}
switch (assGroup){
case "1" : userName = "user 1"; break;
case "2" : userName = "user 2"; break;
case "3" : userName = "user 3"; break;
[......]
}
issue.setAssignee(ComponentAccessor.getUserManager().getUserByName(userName))
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Celik Vedat You are welcome. I am glad it works for you!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I ran into this issue also. Simple answer is you cannot because the values set in a transition screen are not reliably (and most times not) available during the post function since they are set asynchronously.
Convert your post function to a listener and trigger off issue update within the project for the issue type.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What you mean is creating a listener in Script-Listeners > Custom script and select the event ISSUE UPDATE right? Can you explain in detail how to modify my code so it fits for the listeners? What's new to me is: How can I refer to my Transition Action?
Best,
Vedat
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.