Hi,
In create issue Screen, i have a multi select custom field, which has below options
Options: Reviewer 1, Reviewer 2, Reviewer 3, Reviewer 4 ...
User can be able to choose/tick as many options he wanted,
like if user selected/tick: Reviewer 1, Reviewer 4 - then i need to create sub tasks and assign it to selected Users from Multi select custome field
Sub Task 1:
1. Assign to Reviewer 1
2. Copy Summary from Parent Issue
Sub Task 2:
1. Assign to Reviewer 4
2. Copy Summary from Parent Issue
Your help is appreciated
Hi,
In create issue Screen, i have a multi select custom field, which has below options
Options: finance , construction, banking , electrical.
User can be able to choose/tick as many options he wanted,
like if user selected/tick: finance and construction - then i need to create sub tasks from Multi select custom field.
Sub Task 1:
Sub Task 2:
( do you have a script for this)
I was able to achieve this with below code, in case any one needed
cfStewards = customFieldManager.getCustomFieldObjectByName("Stewards")
Collection<User> users= (Collection) issue.getCustomFieldValue(cfStewards);
if(users != null)
{
for(i in 0..users.size()-1)
{
Object AssigneeValue = users.get(i).getName();
issueObject = issueFactory.getIssue()
issueObject.setProject(issue.getProject())
issueObject.setIssueTypeId("10")
issueObject.setParentId(issue.getId())
issueObject.setSummary(issue.getSummary())
issueObject.setAssigneeId(AssigneeValue)
subTask = issueManager.createIssue(authenticationContext.getUser(), issueObject)
subTaskManager.createSubTaskIssueLink(issue.getGenericValue(), subTask, authenticationContext.getUser())
i++
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Do you add this to the post function after you have the field filled in with the users?
is "Stewards" the name of your field?
Anything else I would need to set to customize it for my setup?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, you have to add it to the post funtion, this will run after you filled in users.
In order to work for you, you need to set correct sub task issue type id..
issueObject.setIssueTypeId("10") --- check this ID in your database for correct sub task issue type id
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, In create issue Screen, i have a multi select custom field, which has below options Options: Reviewer 1, Reviewer 2, Reviewer 3, Reviewer 4 ... User can be able to choose/tick as many options he wanted, like if user selected/tick: Reviewer 1, Reviewer 4 - then i need to create sub tasks and assign it to selected Users from Multi select custome field Sub Task 1: 1. Assign to Reviewer 1 2. Copy Summary from Parent Issue Sub Task 2: 1. Assign to Reviewer 4 2. Copy Summary from Parent Issue Your help is appreciated
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.
I have a number field. based number I want create subtask. if I enter 5 then I want to create 5 subtasks. if I enter 10 then I want to create 5 subtasks Please help me on same
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mallikarjuna, Have you created Number field? If Yes, you can loop thru your custom number field and create subtasks based on number selected you should be able to use above code have you tried with above example?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
yes I created number field and tried above code. but not working above code can I write this code in postfunction or listener? what listener can I use? for ex Create a subtask or fast track transition.....
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.
Hi Govardhan can u give me the Import class for above code .
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here are the imports i have used import com.atlassian.jira.issue.Issue import com.atlassian.jira.util.ImportUtils import com.atlassian.jira.workflow.WorkflowTransitionUtil; import com.atlassian.jira.workflow.WorkflowTransitionUtilImpl; import com.atlassian.jira.util.JiraUtils; import java.lang.Boolean; whats the error you are getting? when you say not working.. whats your issue?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
r u woking above code on fasttrack transition? or any other post function. how can i test my code is working or not i am new to jira scripting
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
below is my coding import com.atlassian.jira.issue.Issue import com.atlassian.jira.util.ImportUtils import com.atlassian.jira.workflow.WorkflowTransitionUtil; import com.atlassian.jira.workflow.WorkflowTransitionUtilImpl; import com.atlassian.jira.util.JiraUtils; import java.lang.Boolean; cfLic = customFieldManager.getCustomFieldObjectByName("Number of Licenses") Collection<User> users= (Collection) issue.getCustomFieldValue(cfLic); if(users != null) { for(i in 0..users.size()-1) { Object AssigneeValue = users.get(i).getName(); issueObject = issueFactory.getIssue() issueObject.setProject(issue.getProject()) issueObject.setIssueTypeId("10417") issueObject.setParentId(issue.getId()) issueObject.setSummary(issue.getSummary()) issueObject.setAssigneeId(AssigneeValue) subTask = issueManager.createIssue(authenticationContext.getUser(), issueObject) subTaskManager.createSubTaskIssueLink(issue.getGenericValue(), subTask, authenticationContext.getUser()) i++ } }
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Are you using a multi-user select field?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can use Jamie Echlin's script runner plugin. You might find the example code here helpful
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the response Bhushan, script in the link you provided is to create sub tasks and copy parent values to subtasks which i did already, but now i want to read/get selected values from multi select custom field and set sub tasks assignee based on it
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Govardan and Bhushan I have a similar requirement, when a custom field is set to 'Yes', need to create a subtask and assign to a user id I modified below script like this, and i am getting error msg, can you pls help with this. {code} cfDocReqd = customFieldManager.getCustomFieldObjectByName("Is Documentation (TD) Required?") cfvalue = issue.getCustomFieldValue(cfDocReqd); if (cfvalue= "Yes") { issueObject = issueFactory.getIssue() issueObject.setProject(issue.getProject()) issueObject.setIssueTypeId("10538") issueObject.setParentId(issue.getId()) issueObject.setSummary(issue.getSummary()) subTask = issueManager.createIssue(authenticationContext.getUser(), issueObject) subTaskManager.createSubTaskIssueLink(issue.getGenericValue(), subTask, authenticationContext.getUser()) } {code} Error i am getting : Script function failed on issue: : 101, file: <inline script> groovy.lang.MissingPropertyException: No such property: customFieldManager for class: Script8 at Script8.run(Script8.groovy:1) I am using this as post function to test this, once this is good, i want to use this as custom listener.
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.