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 !!!
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.ComponentAccessor
def projectManager = ComponentAccessor.projectManager
def permissionSchemeManager = ComponentAccessor.permissionSchemeManager
def 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
Online 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.