Jira smart value for a customer's organization
Asked by Sam Osborne:

I have customers and their email addresses assigned to different organizations. The customers submit tickets via the request portal.

I'm trying to create an automation rule that, upon creation of a new issue (i.e. submission of a new request ticket), populates a custom field on the issue named "Requester org" with the organization that is associated with the requester.

The custom "Requester org" field is a "Short text" field and is added to the proper field configuration and screens.

My automation rule is as follows: When an issue is created THEN edit the issue field "Requester org" to this value: {{issue.reporter.customer?.organization?.name}}.

The "Requester org" field still appears blank as I test this with customers. **Is my Jira expression to fetch the requester's org incorrect?**


Answers:
author: Marc - Devoteam
body: Hi [@Sam Osborne](/t5/user/viewprofilepage/user-id/5389148)

I looked at your request and the replies already on this.

The issue is that when having an automation on creation, the information to use an edit action is not available yet.

Can you add another action between the creation trigger and the edit action, use the action Re-fetch issue data.

This action lets the automation now that it's populating the rule cache with all the data in the issue after creation.

This should now set the field "Requestor Org"

comments: author: Sam Osborne
body: Hey thanks for the response. I tried your suggestion, but it unfortunately did not work either. Here is my automation rule (I'm testing multiple jira smart values):

![b;ah.png](https://community.atlassian.com/t5/image/serverpage/image-id/299463iF9F993FE19D4FB6B/image-size/large?v=v2&px=999 "b;ah.png")

Upon submitting a ticket with 'share with: no one' selected, as so:

![blah1sdf.png](https://community.atlassian.com/t5/image/serverpage/image-id/299466i2F2972E53FBA7C39/image-size/large?v=v2&px=999 "blah1sdf.png")

the ticket still appears without the Requester Org field populated:  
![sdfsdfdf.png](https://community.atlassian.com/t5/image/serverpage/image-id/299467iF457E84787D37DE9/image-size/large?v=v2&px=999 "sdfsdfdf.png")

I'm beginning to think this is an issue with the smart value itself. Or the Organization entity is not even available when 'no one' selected.

For what it's worth, I tried {{reporter.emailAddress}} and the email address populated successfully. {{reporter.Organizations}} did not, however.


author: Marc - Devoteam
body: Hi [@Sam Osborne](/t5/user/viewprofilepage/user-id/5389148) and [@Stanley Duback](/t5/user/viewprofilepage/user-id/5348867)

I think I know why the field stays blank.

As [@Sam Osborne](/t5/user/viewprofilepage/user-id/5389148) mentions that the Organizations ootb field is only populated when the issue is shared with an Organization, than if not shared the field is empty.

I have seen this mentioned before:

"If a customer who belongs to an organization creates a ticket via the portal, their organization will be added to the ticket **unless** they are members of more than on organization, then it will be a private request (Organization is null)."

I haven't seen or been able to find a solution for this


author: Sam Osborne
body: Thank you. The submitter's email address does come through, however. So I'm working through pulling their organization using that.


author: Stanley Duback
body: The field for "Organizations" already automatically populates the organization of the reporter when the issue is created, is there a specific reason why you would need a different custom field that provides the same functionality? and if so did you already try fetching issue.organizations

comments: author: Sam Osborne
body: Thanks for the answer. It's my understanding that the Organizations field populates with the reporter's organization ONLY when the reporter selects their organization from the "Share with" drop down field that appears when they're filing a request ticket. If they select Share with - "No one", then the Organizations field does not populate.

This is the experience I have seen when testing. Altering this functionality so that the Organizations field always populates would of course solve my problem. Is there something I can do?


author: Stanley Duback
body: Thanks for expanding on that Sam,  

I just tested out a few different smart values for Issue organizations, and heres what I found  

The smart value for trying to fetch data based on reporter populates blank, by trying to fetch issue org name I was successful, and just issue org gave all of the properties of the issue.  

I have a user with a org called "Test org" had that user submit a ticket, then ran this automation to see if it pulled the smart value properly.  

When using {{Issue.Organizations.first.name}} the smart value pulled the users org properly every time. Have you attempted automation using this smart value?  

![issueorg.png](https://community.atlassian.com/t5/image/serverpage/image-id/297258i78A71FDCA3A0BB63/image-size/large?v=v2&px=999 "issueorg.png")  

![automation.png](https://community.atlassian.com/t5/image/serverpage/image-id/297257iFCD895127C66EE73/image-size/large?v=v2&px=999 "automation.png")


author: Sam Osborne
body: This did not work unfortunately. Here's what I did:

automation rule:

![Screenshot 2023-12-18 154404.png](https://community.atlassian.com/t5/image/serverpage/image-id/297259iA4570E6C60462BA4/image-size/large?v=v2&px=999 "Screenshot 2023-12-18 154404.png")

results in queue after test submissions:

![Screenshot 2023-12-18 154518.png](https://community.atlassian.com/t5/image/serverpage/image-id/297260iB87B834F2C85827A/image-size/large?v=v2&px=999 "Screenshot 2023-12-18 154518.png")

The Requester org custom field is still blank after running a couple tests. I am very new to Jira so might be missing something elsewhere. Thanks


author: Stanley Duback
body: Hey Sam,  

I am not sure why your field would be pulling blank, it would be hard to find a root cause without looking at it.  

Can you try this JQL and see if it pulls up tickets for you?  

*reporter in organizationMembers("")*   

and inside the parentheses would be the name of whatever org this would help determine if those users are getting assigned to the org properly


author: Sam Osborne
body: Okay I dropped this in the JQL line. It does work for different orgs, but it only filters to show closed items. Any open items from different orgs do not appear (I have 'All Issue' selected as well for what it's worth).

Since the tickets I was testing with are still open, they do not appear when I drop their associated org into the parenthesis.


Tags: cloud

jira-service-management

jira-service-management-cloud