Please forgive me if this is a complete mess this is the first time I have tried to use a Behavior-I have two custom fields - Contract Type and Department I want to set the Security Level based off a combination of both of these when ever the issue is updated (Mainly when the Department or Contract Type are updated)
I created a Behavior for the Workflow OCR-Contracts
Then added the Field: SecurityLevle and (Server Side Script) I added the following code: that give me a red x next to every line that says Issue.setSecurityLevleID with "The variable issue is undeclared"
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.ManagerFactory
import com.atlassian.jira.issue.security.IssueSecurityLevelManager
import com.atlassian.jira.issue.security.IssueSecuritySchemeManager
import com.atlassian.jira.issue.IssueImpl
import org.apache.log4j.Category
import com.atlassian.jira.issue.MutableIssue;
import org.ofbiz.core.entity.GenericValue
import com.atlassian.jira.ComponentManager;
import com.atlassian.jira.bc.project.component.ProjectComponent;
import com.atlassian.jira.bc.project.component.ProjectComponentManager;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.issue.IssueFactory;
ComponentManager componentManager = ComponentManager.getInstance() ;
def ContactType = getCustomFieldValue("Contract Type")
def Department = getCustomFieldValue("Department")
if(ContactType && Department)
{
if( (ContactType == "OCR Clickthrough Agreement") &&
(Department == "Business to Business") )
issue.setSecurityLevelId(10303)
}
else if( (ContactType == "Advertising Agreement") && (Department == "Business to Business") )
{
issue.setSecurityLevelId(10304)
}
else if( (ContactType == "Data Use Agreement") && (Department == "Business to Business") )
{
issue.setSecurityLevelId(10304)
}
else if( (ContactType == "Clickthrough/Electronic Agreement") && (Department == "Business to Business") )
{
issue.setSecurityLevelId(10304)
}
else if( (ContactType == "Facilities Agreement") && (Department == "Business to Business") )
{
issue.setSecurityLevelId(10304)
}
else if( (ContactType == "Instructor Agreement") && (Department == "Business to Business") )
{
issue.setSecurityLevelId(10304)
}
else if( (ContactType == "License Agreement") && (Department == "Business to Business") )
{
issue.setSecurityLevelId(10304)
}
else if( (ContactType == "Memorandum of Agreement/Understanding") && (Department == "Business to Business") )
{
issue.setSecurityLevelId(10304)
}
else if( (ContactType == "Non-disclosure Agreement") && (Department == "Business to Business") )
{
issue.setSecurityLevelId(10304)
}
else if( (ContactType == "Other Agreement") && (Department == "Business to Business") )
{
issue.setSecurityLevelId(10304)
}
else if( (ContactType == "Rental Agreement") && (Department == "Business to Business") )
{
issue.setSecurityLevelId(10304)
}
else if( (ContactType == "Services Agreement") && (Department == "Business to Business") )
{
issue.setSecurityLevelId(10304)
}
else if( (ContactType == "Shipping Agreement") && (Department == "Business to Business") )
{
issue.setSecurityLevelId(10304)
}
else if( (ContactType == "Speaker Agreement") && (Department == "Business to Business") )
{
issue.setSecurityLevelId(10304)
}
else if( (ContactType == "Software and/or Software-as-a-Service Agreement") && (Department == "Business to Business") )
{
issue.setSecurityLevelId(10304)
}
else if( (ContactType == "Vendor Registration") && (Department == "Business to Business") )
{
issue.setSecurityLevelId(10304)
}