Hi,
I need to have the value of the assignee user on a Custom Field (in order to send Jemh notifications with this value on the From field).
How can I set my custom Field with this value on asignation action?
Thank you in advance for your answers.
Hello,
You would need an add-on for it. For example, you could use the Power Scripts add-on:
You could create a listener on the Assigned event with a code like this:
#{Custom field name} = assignee;
With Scriptrunner, you can with listener, update customfield with current assignee once assignee set/changed.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you.
Please, could you give us more detail about this option? (Which kind of listener to use and how to set it - if you have done before)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Go to "Add-ons" -> Script Listeners -> Add new item -> custom listener
In the field "Event" choose "issue assigned"
in "inline script" you have to write a groovy script that will update your customfield with the current assignee.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I'm using this groovy script:
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.component.ComponentAccessor
def issue = event.issue as Issue
def CustomFieldManager = ComponentAccessor.getCustomFieldManager()
def tgtField = CustomFieldManager.getCustomFieldObjects(event.issue).find {it.name == "Assign User"}
def tgtField1 = CustomFieldManager.getCustomFieldObjects(event.issue).find {it.name == "Assign User (Text)"}
// name of your custom field
def assignee = issue.assignee
// get assignee
def changeHolder = new DefaultIssueChangeHolder()
tgtField.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(tgtField), assignee),changeHolder)
tgtField1.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(tgtField1),issue.getCustomFieldValue(tgtField)),changeHolder)
// set value of custom field to assignee
Assig User is a User Picker custom field and Assig User (Text) is a Single Line Text custom Field
First part is correct, Assig User takes the right value, but I need to copy it on a text field, I'm sure the problem is on this part:
tgtField1.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(tgtField1),issue.getCustomFieldValue(tgtField)),changeHolder)
I have tested it and if I change issue.getCustomFieldValue(tgtField) for "test", it works, please, could you help me with this?
Thank you in advance.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The second line fails because the text field expects text, and you're throwing a user object at it.
Try giving it the user's name as a string instead:
tgtField1.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(tgtField1), assignee.getName() ),changeHolder)
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.