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.
Jira Product Discovery Premium is now available! Get more visibility, control, and support to build products at scale.
Learn moreOnline 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.