Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.

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

Get attribute of asset custom field

Syed Muhammad Umair Mansoor
Contributor
October 7, 2023

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.PNG is 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.
October 8, 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,

Syed Muhammad Umair Mansoor
Contributor
October 8, 2023

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.
October 8, 2023

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

Syed Muhammad Umair Mansoor
Contributor
October 9, 2023

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
TAGS
atlassian, atlassian government cloud, fedramp, webinar, register for webinar, atlassian cloud webinar, fedramp moderate offering, work faster with cloud

Unlocking the future with Atlassian Government Cloud ☁️

Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.

Register Now
AUG Leaders

Upcoming Jira Events