Project Smart Value in script

Maahshid Vaziri August 9, 2022

Hi 

I am looking to write a rule that if a field changes in any project, the access of that project will also change. For this, I used the Projected Update Field section and I also got help from the Script Runner program for the action, but for the access of the project to limit automatically, I need to give it the project key first, since the role can be executed for any project, I don't have a default value for it, can you help me how to get the key of the project in which a field has been changed ?

2 answers

0 votes
Bill Sheboy
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.
August 10, 2022

Hi @Maahshid Vaziri 

Context is important for smart values like Project:

  1. {{project}} by itself works for project-related triggers, and
  2. when you have an issue trigger/branch, you instead use {{issue.project}}

Which of those applies for your rule's trigger?

Kind regards,
Bill

Maahshid Vaziri August 10, 2022

Hi @Bill Sheboy 

I think I didn't express my problem well, after the rule is executed, I want to limit access to the project with the script runner program, for this purpose, I need to see by scripting which project was the rule executed on (actually I need the project key for this.) But smart values don't work in scripting, and I don't know how to get the project key that the rule is run on it.

If it helps, I should say that the rule is executed when a custom field is changed in the project. That is, we don't know which project it is by default, we want this role to be executed whenever a specific field is changed in any project.

Bill Sheboy
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.
August 11, 2022

I am unclear how to do that.

Would you please clarify the problem you are trying to solve by limiting project access after a field changes?  And, what does "limit access to the project" mean to you?

Perhaps if you update your question to address those things the community will have more ideas how to help.  Thanks!

0 votes
Tansu Akdeniz
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 10, 2022

Hi @Maahshid Vaziri 

It seems that there is space btw project and .key. Please double check it.

{{project.key}}

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-projects/ 

Maahshid Vaziri August 10, 2022

Hello @Tansu Akdeniz 

Thanks for your support but, I think I didn't express my problem well, after the rule is executed, I want to limit access to the project with the script runner program, for this purpose, I need to see by scripting which project was the rule executed on (actually I need the project key for this.) But smart values don't work in scripting, and I don't know how to get the project key that the rule is run on it.

If it helps, I should say that the rule is executed when a custom field is changed in the project. That is, we don't know which project it is by default, we want this role to be executed whenever a specific field is changed in any project.

Suggest an answer

Log in or Sign up to answer