Please try this and let me know the results.
import com.atlassian.jira.ComponentManager import com.atlassian.jira.issue.CustomFieldManager import com.atlassian.jira.issue.Issue import com.atlassian.jira.issue.ModifiedValue import com.atlassian.jira.issue.IssueManager import com.atlassian.jira.issue.MutableIssue import com.atlassian.jira.issue.comments.CommentManager import com.atlassian.jira.issue.fields.CustomField import com.atlassian.jira.util.ImportUtils import com.atlassian.jira.user.util.DefaultUserManager import com.atlassian.crowd.embedded.api.User IssueManager issueManager = ComponentAccessor.getIssueManager() CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager() CustomField myCustomfield = customFieldManager.getCustomFieldObjectByName("alfrageteilnehmer") if(issue.getProjectObject().getKey() == 'ABC'){ myCustomfield.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(myCustomfield), "tg"),changeHolder); }
This code doesn't work, bev´cause the expression have to retun "true".
You have to do it this way.
image2016-6-15 11:25:29.png
It works, thank you very very much. Your post was the hint I needed to finde the solution.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Glad that it worked. That script I had shared will work directly to set the field value via a scripted post function (instead of returning a true boolean value for a condition in a built-in post function.) However, you made it work for the second scenario. Congrats!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
To be more precise, I was checking the project name and setting the field value on my own in the script. It works in the scripted post function option.
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.
My understanding is, you need a post function to set this custom field value based on the project name. For example, if project name is 'abc', then the field alfrageteilnehmer has to be set as 'tg'. Am I right?
If not please explain.
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.