Updated by
Modified
ScriptRunnerforJiraCloudExampleWorkflowValidatorss.groovy- Ignore whitespace
// The stories paramater returns all the issues below the Epic issue to allow there status to be checked.
issue.isEpic && issue.stories.filter(story => story.status.name == 'Done').length == issue.stories.length //You may also want to set the Error message to have text similar to 'You must ensure all issues inside the Epic are in the Done status before the Epic issue can be closed'
+// The second expression joined by the && operator mandates that the user must be in a specific project role to create the issue type from expression1
+// The third expression specifies that all other issue types used by the project can be created. add new issue types by adding them in and seperating them with a | character
+issue.issueType.name.match('^(<IssueTypeHere>)$') != null && user.getProjectRoles(project).map(p => p.name).includes("<ProjectRoleHere>") || issue.issueType.name.match('^(<IssueTypeHere>|<IssueTypeHere>)$') != null //You may also want to set the Error message to have text similar to 'You must be in the X Project Role to create the X Issue Type'