Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to get Issue's Project Key with post function in jira cloud?

erika_zanoni February 2, 2021

Hi,

I need to save the Project Key in a variable when I create an Issue.

I've tried issue.project.key and also issue.projectKey  but doesen't work

how to do it?

 

Thanks

1 answer

0 votes
Nishanth Thimmareddy (Appfire)
Atlassian Partner
February 2, 2021

Hi @erika_zanoni

Welcome to the community!

If I have understood your requirement correctly. You can use the Create issue post function and the substitution variable %original_project% while setting the custom field. Let me know if you have any questions.

Disclosure: I am the product manager for Create on Transition for Jira Cloud.

Thanks,

Nishanth T

erika_zanoni February 2, 2021

Hi Nishanth,

I'm doing a scriptrunner post function and I need to use the JQL Search API to find some issue, for this reason I need to create a Variable and use that in the JQL expression like: "Project = ${variable}"

I need to get the Project Key from the Issue I have created, because the post function start after the creation of that issue. I can get the issue key doing issue.key, there is a similar way to get che project key?

Thanks

Kristian Walker _Adaptavist_
Community Champion
February 2, 2021

Hi Erika,

I can confirm that this is not possible t create a variable that can be used in a JQL search as Atlassian does not support variables being passed into a JQL query.

I can confirm that when you create an issue you can reference the issue object which comes in the binding of your script and below this you will be able to get the issue key and you can then write some logic to strip away all characters after the - character as this will give your project Key as Atlassian do not store the project key below an issue so this is the only way to get it with ScriptRunner for Jira Cloud.

Regards,

Kristian

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events