Need to return true if and only if the following condition is true
the customfield ="CTI Alert" or (the user in group TIER2 and customfield !="CTI Alert")
import com.atlassian.jira.component.ComponentAccessor;
def customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObject("11504");
def value = (String)issue.getCustomFieldValue(customField);
if (value = "CTI Alert") || (value != "CTI Alert") && isUserMemberOfGroup('Tier2')
{
return true;
else
return false;
}
What could be the problem and what is the correct syntax?
What is the error? I am not a compiler, but I can see two problems
def customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_11504");
if(( (value = "CTI Alert") || (value != "CTI Alert")) && isUserMemberOfGroup("Tier2"))
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.component.ComponentAccessor;
CustomField customField_name = customFieldManager.getCustomFieldObjectByName('Incident Source');
def customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_11504");
def value = (String)issue.getCustomFieldValue(customField);
if(( (value = "CTI Alert") || (value != "CTI Alert")) && isUserMemberOfGroup("Tier2"))
return true;
else
return false;
Currently testing this, seems no errors raised
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try like this:
import com.atlassian.jira.component.ComponentAccessor;
def customField_name = customFieldManager.getCustomFieldObjectByName('Incident Source');
def customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_11504");
def value = (String)issue.getCustomFieldValue(customField);
if(( (value = "CTI Alert") || (value != "CTI Alert")) && isUserMemberOfGroup("Tier2"))
return true;
else
return false;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Spend the day sharpening your skills in Atlassian Cloud Organization Admin or Jira Administration, then take the exam onsite. Already ready? Take one - or more - of 12 different certification exams while you’re in Anaheim at Team' 25.
Learn more
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.