Hi,
i wanted set the Developer field values as same in assignee field in a transition screen.
I've tried with Groovy script ( set field value ) on post function.
Below is the code snip:
if(issue.getIssueTypeObject().getName()=="Bug")
{
issue.get("assignee")?.getName()
}
it complies without any error but the screen doesn't showing the expected result.
Any suggestions on this ?
You don't appear to be using a set in your code. When you do, https://scriptrunner.adaptavist.com/latest/jira/recipes/workflow/postfunctions/set-issue-attributes.html is a good bookmark for sample code.
Thanks for the Reply @Nic Brough -Adaptavist- , i've one more query i.e whether the first code in the above link will work for copying value from system field to system field ?
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.
Broadly, yes, I think you can see how to use other fields in there.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've tried with setCustomFieldValue seems something missing. i have added my code below. can you have a look on it ?
its returning Null, but the assignee field is not empty for the case I've tested with.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The result is what the script returns. You have no return value at the end, so it's coming out with null.
I think you need to return either the assignee or the current value of the field (so it doesn't replace it with null)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Nic Brough -Adaptavist- Thank you :) That really worked well.
below is the final code :
import com.atlassian.jira.*
import com.atlassian.jira.user.*
import com.atlassian.jira.component.ComponentAccessor
def userUtil = ComponentAccessor.getUserUtil()
if (issue.issueTypeObject.name == "Bug")
{
issue.setAssignee(userUtil.getUserByName("User Name"))
return (issue.get("fieldA").getName())
issue.store()
}
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.