Skip to main content
Example scripts
arrow icon
To homepage
Jira
Cloud icon
Cloud

Add user to project role

Created 9 month(s) ago, Updated 7 day(s) ago
App in script
ScriptRunner For Jira
ScriptRunner For Jira
by Adaptavist
Compatibility
compatibility bullet
Jira
Language |
groovy
def myself = Users.getLoggedInUser()

def projectKey = 'TP'
def roleId = '10002'

def result = post("rest/api/3/project/${projectKey}/role/${roleId}")
    .header('Content-Type', 'application/json')
    .body([
        "user": [myself.accountId]
    ])
    .asObject(Map)

result.body
Having an issue with this script?
Report it here