How to Restrict Priorities by Request type? (ScriptRunner)

Mariam Hovhannisyan
Contributor
March 14, 2024

Dear Community,

I want to hide my priority list only for one Request type.

The following script works only for the issue type create/edit/view screen but not works for the Request type create screen in Portal.

tempsnip2.png
tempsnip2.png

 

Restriction for project and issue type I configure not in script but in Mapping:
tempsnip.png

My script is here:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.fields.config.manager.PrioritySchemeManager
 
import static com.atlassian.jira.issue.IssueFieldConstants.PRIORITY
 
def prioritySchemeManager = ComponentAccessor.getComponent(PrioritySchemeManager)
 
def userUtil = ComponentAccessor.getUserUtil()
 
def currentUser = ComponentAccessor.jiraAuthenticationContext.getLoggedInUser()
def allowedPriorities = prioritySchemeManager.getOptions(issueContext).findAll {
        it.toInteger() < 5
    }
 
    getFieldById(PRIORITY).setFieldOptions(prioritySchemeManager.getPrioritiesFromIds(allowedPriorities))

P.S. I need to show priorities Highest - id=1, High - id=2, Medium - id=3, Low - id=4.
Thanks in advance.
Regards,
Mariam

1 answer

1 accepted

3 votes
Answer accepted
Sebastian Krzewiński
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 14, 2024

Hi @Mariam Hovhannisyan 

 

Did you set availability for request forms on portal? Based on screenshots I see that you limit it only for issue type

 

Regards,

Seba

Mariam Hovhannisyan
Contributor
March 14, 2024

Dear @Sebastian Krzewiński ,

Thanks a lot. I had used "Use project / issue type mapping". I have changed it "Use Service Desk mapping" and it works now.

Capture.PNG

Regards,
Mariam

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events