Hi guys !
I'm trying to create a script with behaviour (server-side script),
but the problem for me is im getting null from getFieldById("fixVersions));
or either getFieldByName("Fix Version/s");
neither FormField instead of def fixVersions = getFieldById("fixVersions");
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.project.version.Version
import com.onresolve.jira.groovy.user.FieldBehaviours
import com.onresolve.jira.groovy.user.FormField
import com.atlassian.jira.project.version.Version
Issue issue = event.issue;
Collection<Version> version = issue.getFixVersions();
def fixVersion = getFieldById("fixVersions");
//def values= fixVersion.getValue();
def values = fixVersion.getValue() as List<Version>
if(values == null || values == "" || !values){
fixVersion.clearError();
}
for(int ver = 0; ver < version.size(); ver++){
boolean isReleased = version[ver].isReleased();
if(isReleased){
fixVersion.setError("Cant Assign Issue To A Released Version !");
} else{
fixVersion.clearError();
}
}
any help solving ?
Thank you!
Hi Shachar, welcome to the Atlassian Communit!
Have you tried:
getFieldById(
"fixVersions"
)
I had to look it up but that is used in the vendor's documentation on this page.
Hi Charlie, thanks for the reply, Yes i have tried even copying the documentation code, doesnt seem to catch the field event.
tried getFieldChanged aswell, same result.
affter adding a version, this is the result from the script runner logs :
---- Form field ID: fixVersions, value: null.
i have read the decomentation over and over haha.
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.