You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
I wanted to add user to project whenever project access request is raised
Tried to create a script to match my scenario, However it is bringing me Project ID: 
But I am looking for a project key to pass in addActorsToProjectRole
14805 is an asset custom fields whose scope in asset is objectType = service and in this service object we have an attribute call “JiraKey”, Type: Project, containing all Jira projects in it, Below script:
is bringing project id and I want project key.
Can anyone help?
We have a Service Request in JSM from where user can raise a request to access Jira, Confluence, Bitbucket, Bamboo etc.
We had a script that was used to automate their access based on some conditions, so they get access directly without any manual transition we were calling APIs and parameterizing those APIs with user requests (project/role/username),
Now our JSM architecture has been changed and we are taking inputs from multiple ways as below:
1- Service (Project) → Insight Custom Field : for Every service there is an attribute Jira key which is basically Type: Project in Jira bringing all Jira projects in it to select and map, in short for every Service there is respective Jira Project here in this attribute
(E.g: Service name: A, Jira Key: A)
2- User Role and Components → are two fields those are *Forms (*ProForma) fields,
User role are list of roles we have defined in Jira, and Components are Jira, Wiki, Bitbucket, Bamboo
Here I would like to have a script which can provide the access to the requested user directly (automated) upon opening up a request, (transition can be done through automation) but I need a script to be executed in a post function to give them access instantly.
For your first question, you can use the following method to get the project by ID:
def project = ComponentAccessor.getProjectManager().getProjectObj(projectKey)
You should replace the line 28 in your code by the line I proposed.