Hi,
The below behaviour script is not working for multi cascade select field.
It is hiding the multi select custom field on the edit screen for a project role member for a specific issue type but not working for multi cascade select custom field.
The multi cascade select custom field is coming from a plugin.
Can anyone please help with the correction?
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.security.roles.ProjectRoleManager
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
import static com.atlassian.jira.issue.IssueFieldConstants.ISSUE_TYPE
@BaseScript FieldBehaviours fieldBehaviours
// Get the custom field manager def customFieldManager = ComponentAccessor.getCustomFieldManager()
def projectRoleManager = ComponentAccessor.getComponent(ProjectRoleManager)
def user = ComponentAccessor.jiraAuthenticationContext.loggedInUser
def issue = underlyingIssue
// Define the issue type, restricted roles, screen, and restricted statuses
def restrictedIssueType = "Project"
def restrictedRoles = ["Product Owner"]
def restrictedStatuses = ["Initial Review", "Demand Committee Review", "In BA Queue", "BRD Review", "BRD Preparation", "User Story Preparation", "In UI/UX Queue", "UI Design", "UI Review", "In Delivery Queue", "In Design Queue", "SBP Preparation", "LLD Preparation", "SOW Review", "SOW Preparation", "Planning", "Development", "Ready For SIT Deployment", "SIT Release Deployment", "Ready For Testing", "QA Execution", "QA Blocked", "UAT", "Ready For UAT", "UAT Verification", "UAT Blocked", "Go-Live Preparation", "TAB Review", "CAB approval", "PIV", "Production Deployment", "Market Live", "Business Inputs", "Pending-Control Function Approval", "On-Hold", "Cancelled"]
def screen = 'TEST: ARC Edit screen.TEST'
// Check if the issue type matches the restricted issue type
def isIssueTypeRestricted = (issue.issueType.name == restrictedIssueType) log.warn""+isIssueTypeRestricted
// Get user roles in the project
def userRoles = projectRoleManager.getProjectRoles(user, issue.projectObject)*.name log.warn""+userRoles
// Check if issue status is in the restricted statuses
def isStatusRestricted = restrictedStatuses.contains(issue.status.name) log.warn""+isStatusRestricted
// Check if user is in any restricted roles
def isUserRestricted = userRoles.any { it in restrictedRoles }
log.warn""+isUserRestricted
def isScreenName = (fieldScreen.name == screen)
log.warn""+isScreenName
// Target specfic fields
def multiSelectField = getFieldById("customfield_12804")
def multiCascadeField = getFieldById("customfield_16503")
if (isIssueTypeRestricted && isStatusRestricted && isUserRestricted && isScreenName) { log.warn"yes"
//getFieldIds().each { fieldId ->
//getFieldById(fieldId).setReadOnly(true)
multiSelectField?.setHidden(true)
multiCascadeField?.setHidden(true)
}
else { //getFieldIds().each { fieldId ->
// getFieldById(fieldId).setReadOnly(false)
multiSelectField?.setHidden(false)
multiCascadeField?.setHidden(false)
}
Regards,
Hi @SysAdmin
Please confirm: Is the Multi Cascading List that you mentioned a feature that is provided by the third-party plugin provider Sourcesense?
If yes, I can confirm that ScriptRunner for Jira doesn't provide any direct support for this plugin, and we cannot confirm that it will work directly.
Since it's provided by Sourcesense, you must create a ticket with Sourcesense and request that they use the Vendor's API so they can Integrate their plugin and get it to work with ScriptRunner's Behaviour.
Thank you and Kind regards,
Ram
ScriptRunner's Vendor's api has been implemented in version 7.0.2
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.