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.
With Scriptrunner, you can with listener, update customfield with current assignee once assignee set/changed.
Hello,
You would need an add-on for it. For example, you could use the Power Scripts add-on:
https://marketplace.atlassian.com/apps/43318/power-scripts-jira-script-automation?hosting=cloud&tab=overview
You could create a listener on the Assigned event with a code like this:
#{Custom field name} = assignee;
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)
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.
I'm using this groovy script:
import com.atlassian.jira.issue.Issueimport com.atlassian.jira.issue.ModifiedValueimport com.atlassian.jira.issue.util.DefaultIssueChangeHolderimport com.atlassian.jira.component.ComponentAccessor
def issue = event.issue as Issuedef 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 fielddef assignee = issue.assignee// get assigneedef 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.
It looks like you're new here. Sign in or register to get started.