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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How do I access a User entity's properties (set via API)?

Hi! I love Code Barrel's Automation plugin.

Now, I can set user properties via API:

curl -D- -d'"VIP User"' -u admin:<password> -X PUT -H "Content-Type: application/json" https://<My JIRA Cloud>.atlassian.net/rest/api/2/user/properties/vip?username=admin

And I can similarly retrieve them:

curl -D- -u admin:<password> -X GET https://<My JIRA Cloud>.atlassian.net/rest/api/2/user/properties/vip?username=admin

 

In the Automation plugin, I can retrieve many Reporter's details, eg., if the Reporter is admin, then I can set the Reporter Username custom field this way:

{
    "fields": {
        "Reporter Username": "{{issue.reporter.name}}"
    }
}


It makes sense to me that this should work, to set a VIP User custom field:

{

    "fields": {
        "VIP User": "{{issue.reporter.properties.vip}}"
    }
}

However this doesn't work. How do I access the "vip" property I set on the user entity in the JIRA Automation plugin?

3 answers

1 accepted

2 votes
Answer accepted
Nick Menere Community Leader Aug 06, 2017

This can be done with the simple format:

{{issue.reporter.properties.vip}}

 

If you area trying to access the properties that are set via UI in user managgement (these are not entity properties but rather a legacy feature in JIRA) you can do the follwoing in Server only:

{{issue.reporter.legacyProperties.vip}}

 

Cheers,

Nick

2 votes
Nick Menere Community Leader Dec 16, 2016

Hi Alex,

Unfortunately this can't be done yet, though it something we will DEFINITELY add - https://codebarrel.atlassian.net/browse/AUT-83

It would really help a lot of use-cases. Watch the issue and we will try to get to it soon.

 

Cheers,

Nick

Has anyone gotten a solution for this?

I'm trying to access a property value within Automation however no value is retrieved using any of the formats suggested above.

Is there any other way in a automation action or condition i can utilize user property values?

Hey @krnaicker  -- Welcome to the Atlassian Community!

After a bunch of tinkering, I finally got this to work in an automation rule:

{{issue.properties."myNameSpaceExample.myKey"}}

The values I used when I Set Entity Property were:

  • Entity Type: Issue
  • Property Key: myNameSpaceExample.myKey

This didn't match any of the documented examples I found thus far; they either had no quotation marks or had them in different locations..  I still cannot get access to the property via JQL.  I am starting to wonder if this feature is still experimental.  :^)

 

Best regards,

Bill

Hey Bill, there's a bit in the docs for Entity properties here that says:

How do I make the properties of an entity searchable?

Jira Server plugins can provide a module descriptor that will make the issue properties searchable using JQL.

https://developer.atlassian.com/server/jira/platform/entity-properties/

So... I guess it works if you're creating a plugin.

Here's details on that module for cloud:

https://developer.atlassian.com/cloud/jira/platform/modules/entity-property/

Oh, and I completely neglected to thank you for the tip on putting the key in quotes.

By the way, it turns out you can ALSO load a whole JSON object into an entity, like so:

{ "App1" : "assigneeid1",
"App2" : "assigneeid2",
"Some App" : "assigneeid3"}

I set the above as the value for a Project Entity Property key subtaskAssignees using an Automation rule.

And then I was able to reference individual keys thusly:

{{project.properties.subtaskAssignees."App1"}}

Now... if I could just figure out how to iterate through a list of Checkbox values and create Subtasks that are assigned according to that mapping, with Summaries based on the Checkbox values, then we'd be in business. :-}

https://community.atlassian.com/t5/Marketplace-Apps-Integrations/Create-Sub-Tasks-from-User-Selection-on-Multi-Value-Checkbox/qaq-p/814856

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Jira Core

How to manage many similar workflows?

I have multiple projects that use variations of the same base workflow. The variations depend on the requirements of the project or issue type. The variations mostly come in the form of new statuses ...

3,953 views 11 5
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you