Hi there,
Laptop and employee are managed by JSM Assets.
I add an attribute to Laptop schema to refer to employee as below:
A laptop and a employee are stored as below:
I want to show only laptops in use on the create service request form.
I know I can get the login user with currentUser().
But I can't get it to work in AQL.
What AQL should I write?
Thanks
Hi @Naoki
The AQL on then custom field context should be working:
objectType = "Laptop" and userInAssets."Atlassian Account ID" = ${reporter}
I suspect that it's not tying the Employee asset to the logged in user. It knows there's an employee and it knows someone is logged in, but it doesn't tie the two together.
If you create an attribute for the Employee and you store the Jira User in it, then you can do:
JiraUser = currentUser()
It looks like that's what you're doing with your Atlassian ID field? What was the actual AQL that failed?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Lori Brown
Assets are related as follows:
After making the relation, I thought I could retrieve it in the next AQL.
However, it could not be retrieved.
objectType = "Laptop" AND userInAssets."Atlassian Account ID" = currentUser()
Can't the attribute values of linked objects be referenced in AQL?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Do you have Confluence? There's a macro "Assets" that's handy for brute-forcing AQL statements that don't behave.
This works in my environment in Confluence:
objectType = "Laptops" and Owner."Jira User" = currentUser()
"Owner" is a link to an asset of Employee type.
"Jira User" is an attribute of Employee of type "User"
If I add this query to the Filter Scope of the Assets custom field (not the Filter Issue scope field), then I get only the one result back that I expected.
In your userInAsset attribute, if you click on the three dots, is there anything on the Filter objects tab?
As a sanity check, if you change the query in your Assets custom field to just objectType = "Laptops" do you get back all Laptops?
How about objectType = "Laptops" and Owner is not empty?
And then: objectType = "Laptops" and Owner."Jira User" is not empty?
The success/failure of those might indicate if there's a syntax problem or if something about currentUser() isn't cooperating.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.