import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.IssueManager;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.issue.MutableIssue
def issue = ComponentAccessor.getIssueManager().getIssueByCurrentKey("DC_CM-1893");
def customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObject(10731L);//customfield id
def appt = getFieldById("customfield_10729")
if(issue.getCustomFieldValue(customField) =~ 'JIRA')
{
appt.setHidden(true);
}
else
{ appt.setHidden(false);
}
We use the above script. In the above code the validation works with existing issue " DC_CM-1893".
Whereas we need to use the behaviour for current issue in create screen.
Not able to get the current issue key and apply validation.
Instead of existing issue we need the current issue which is about to create.
Please let us know how to achieve this.