Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Get attribute of asset custom field

Hi

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: [19905]

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:

 PID to Pkey.PNGis bringing project id and I want project key.

Can anyone help?

 

 

 



Details:


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),

Problem & Scenario:

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

Looking For:

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.

 

1 answer

1 accepted

0 votes
Answer accepted
Seifallah Bellassoued
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Oct 08, 2023

Dear @Syed Muhammad Umair Mansoor

For your first question, you can use the following method to get the project by ID:

def project = ComponentAccessor.getProjectManager().getProjectObj(projectKey)

Best Regards,

Seif,

Where I will pass the project ID, Can you please show me any executed script?

Thanks

Seifallah Bellassoued
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Oct 08, 2023

You should replace the line 28 in your code by the line I proposed.

Thanks @Seifallah Bellassoued 
Actually it worked after some reworks as shown below it was bringing Project: prefix with project key and Project id was coming with [] with it and was not accepting anything other then type Long 
ProjectKey.PNG

Like Seifallah Bellassoued likes this

Suggest an answer

Log in or Sign up to answer