Hello there,
After I programmatically created a Jira project successfully, I need to add a permission scheme and notification scheme to the newly created project. Here is my code:
I successfully added the notification scheme to the newly-created project but I could not add the permission scheme.
What's confusing is that the PermissionSchemeManager: https://docs.atlassian.com/software/jira/docs/api/8.22.5/com/atlassian/jira/permission/PermissionSchemeManager.html and the NotificationSchemeManager: https://docs.atlassian.com/software/jira/docs/api/8.22.5/com/atlassian/jira/notification/NotificationSchemeManager.html all inherit from the parent SchemeManager, therefore both have the addSchemeToProject(Project project, Scheme scheme) method. However, the Scriptrunner editor stated that PermissionSchemeManager doesn't have the method while NotificationSchemeManager has the method and works perfectly.
Any ideas why? Thanks !!!
Hi @Nhat Nam Nguyen
After going through your description, I did a quick test in my environment with the sample code below and didn't encounter any error messages.
import com.atlassian.jira.component.ComponentAccessordef projectManager = ComponentAccessor.projectManagerdef permissionSchemeManager = ComponentAccessor.permissionSchemeManagerdef scheme = permissionSchemeManager.getSchemeObject('Sample')def project = projectManager.getProjectByCurrentKey('MOCK')permissionSchemeManager.addSchemeToProject(project, scheme)
Below is a screenshot of the configuration for your reference:-
If you observe in the screenshot above, no error message is returned. The code is accepted without any issue.
Please try to modify your code according to the example code I have provided above and see if the error persists.
Also, please update your ScriptRunner plugin to the latest release before testing.
Thank you and Kind regards,
Ram
It looks like you're new here. Sign in or register to get started.