Global / Project Variable
Asked by Julian Governale:

I'm looking for a recommendation on a way to best set up a "global" variable for a project. Our scenario is as follows

* Service Request project where Customers submit requests for a new integration
* The ticket is created, and evaluated by the internal team and if doable they then assign it to another team to generate the quote and cost information
* The quote is attached to the Jira ticket and the quote and cost information are captured in the ticket
* The quote is then provided back to the customer to approve or reject
* If approved, we then take the quote (attachment) and cost information and create a Coupa requisition via a Web request in automation
* Once the requisition is approved and PO cut, work can start

#### First Coupa Automation Rule (First Web request) {#toc-hId-291504329}

* Trigger - transition

Get a new bearer token (OAuth 2.0), which expires every 24 hours.

We request the new token and store it in a variable

#### First Coupa Automation Rule (Second Web request) {#toc-hId--1515950134}

We take the token stored in the variable and use it to make an API call to create the requisition in Coupa

#### Second Coupa Automation {#toc-hId-971562699}

* Trigger - Schedule

Once the request is created, we then run another Web Reuqest to check the status of the requisition. We do this as we need the PO# captured (AKA requisition has been approved) before the integration work can begin.

We need to generate a new bearer token as I can't take the token from the previous rule and use it in this second rule

#### What I'm trying to resolve {#toc-hId--835891764}

In both automation rules, we are currently requesting to get a new bearer token. ideally, I would like to use the same token until it expires. In the scheduled rule i would have an if-else to check the web request status and if it comes back unauthorized, i then generate a new token.

Since this is a bearer token, i didn't want to store it in a field within the system, but any recommendation or thoughts on how i could pass this token from the first automation rule to the second would be greatly appreciated.

If there is a way to encode it and then decode it, I would be more open to storing it in a field.


Answers:
author: Marc - Devoteam
body: Hi [@Julian Governale](/t5/user/viewprofilepage/user-id/1147654)

You can't pass information used in a rule to another rule unless you store information within the system.

This field does not need to be on the screen and it could be just a text field.

Even based on you first sentence to set a global variable, to me this is you want to re-use a piece of information. This needs to be stored somewhere to get used globally.

comments: author: Julian Governale
body: Yeah that is what i figured. We do have a security aspect that they indicated we cant store it in the field. Even though it won't be a screen, its searchable in a filter which was their concern since we use tools to move to data to different reporting tool.

Though the risk is very low since we can have that field excluded from going to the other tool, its not 100% safeguard.

Maybe ill make a feature request to Atlassian for a project variable within the automation tool to allow a consent variable to be reused within that project.

Thanks [@Marc - Devoteam](/t5/user/viewprofilepage/user-id/3796976) for the response... love the user icon too!


Tags: automation

cloud

jira-service-management

jira-service-management-cloud