Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Searc Service / Persissions for JSM Customer in Groovy / API

Normann P_ Nielsen _Netic_
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 Champions.
January 15, 2026

I am trying to find issues in a project a JSM Customer Can see.

 

Using the Search Service with the Customers ApplicationUser gives 0 issues.

So I am trying to seach with a jira user and find issues the JSM Customer can see (I have verified on the portal the Customer can see issues:

 

// 1. Get the necessary components
def searchService = ComponentAccessor.getComponent(SearchService)
def userManager = ComponentAccessor.getUserManager()
def permissionManager = ComponentAccessor.getPermissionManager()
def browsePermission = new ProjectPermissionKey("BROWSE_PROJECTS")

// 2. Define the user (the JSM Customer) and the query
ApplicationUser automation = userManager.getUserByKey("automation")
ApplicationUser customer = userManager.getUserByName("bnp@mos-eisley.dk")
def jqlSearch = "project = SUPPORT"

if (customer) {
// 3. Always validate the query for the specific user first
def parseResult = searchService.parseQuery(automation, jqlSearch)
if (parseResult.isValid()) {
// 4. Execute the search within the customer's permission context
def searchResults = searchService.search(automation, parseResult.getQuery(), PagerFilter.getUnlimitedFilter())
def issues = searchResults.getResults()
issues.each { issue ->
if (permissionManager.hasPermission(browsePermission, issue, customer))
{
log.warn("Customer can see: ${issue.key} - ${issue.summary}")
}
else
{
log.warn("Customer cant see: ${issue.key} - ${issue.summary}")
}
}
} else {
log.error("Invalid JQL for this user: " + parseResult.getErrors().getErrorMessages())
}
} else {
log.error("User not found.")
}
No matter what https://docs.atlassian.com/software/jira/docs/api/7.1.2/com/atlassian/jira/permission/ProjectPermissions.html is set in, the result is always the customer cant see the issue.

1 answer

0 votes
Marc -Devoteam-
Community Champion
January 15, 2026

Hi @Normann P_ Nielsen _Netic_ 

Customers are not able to see issues in Jira without an agent license.

This as customers don't have permissions on a JSM project, this requires agent access.

Normann P_ Nielsen _Netic_
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 Champions.
January 15, 2026

@Marc -Devoteam- of cause they are - through the portal in Jira Service Management.... I know they cant see it in "real" jira.

But that was not the question - the question was how do I search out the issues that a user can see (via the portal) . If possible....

 

Thanks for replying :-)

Marc -Devoteam-
Community Champion
January 15, 2026

Hi @Normann P_ Nielsen _Netic_ 

Issues that can be viewed from the portal will need to have the field Request Type set, to an existing Request Type used in the JSM project.

Issues where this field is not set, will not be visible in the portal.

Normann P_ Nielsen _Netic_
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 Champions.
January 15, 2026

I know, and I guess there is a little more to it than that...

Marc -Devoteam-
Community Champion
January 16, 2026

Hi @Normann P_ Nielsen _Netic_ 

What do you mean that there is more than that?

Normann P_ Nielsen _Netic_
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 Champions.
January 16, 2026

I think the short question is:

 

Knowing:

1. A username (possibly a JSM User)

2. A Project Key

 

How do I search out exactly (in groovy) the issues that the user from A can see.

If the user is a Service Customer, it must match the portal.

Marc -Devoteam-
Community Champion
January 16, 2026

Hi @Normann P_ Nielsen _Netic_ 

A customer based on its user has no specific permission.

This is based on the permission: portal access in the permission scheme.

I think if you want to reach your goal, you will need to add each individual customer or a group of all customers in people and access on the project and grant them the role Service Desk Customer.

Otherwise customers are only seen in the customer section of the project and based on portal access permission in the permission scheme have the options to to make actions on the issue via the portal.

They are not actively set on the project as a customer, so I don't think you can find issues by user, as this user is not specified on the project.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events