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

Is it possible to hide a page/section from a user in Jira Service Desk with ScriptRunner

Hi everyone,

 

I have two quick about hiding elements/pages from a user in Jira Service Desk.

 

Is it possible to hide a certain page inside a project from a specific user with ScriptRunner?

I would like to hide the page /customers in a service desk for a specific service desk agent.

 

I know there's a built-in script that can hide the menu icon for customers.

Is it possible to do on a user-level, so that only a particular user in a project doesn't see that menu icon?

 

Thanks a lot in advance :)

Jira server: 8.13.1

Jira service desk: 4.13.1

1 answer

1 accepted

0 votes
Answer accepted

Hi Silas,

In the condition code of the built-in script, you can check which user is logged in with the JiraAuthenticationContext:

def user = ComponentAccessor.jiraAuthenticationContext?.loggedInUser

and use that to decide whether to show or hide the icon.

Joanna Choules
Adaptavist Product Support

Thank you!

Do you know if it would be possible to hide the content on a certain URL altogether using the same check?

The script isn't built for hiding entire pages, but if you can identify the UI elements containing the content you don't want to be shown (the fragment locator might help with this), then you can hide those as well.

Yes indeed. 

I realized yesterday in the evening, that I simply need to hide whatever I need in the same way.

I'm having some trouble locating the id for the section I need to hide. The "Hide UI Element" script only takes Ids that start with com.atlassian something, but the section I would like to hide doesn't have a com.atlassian Id, just an id like this: div.js-page-panel-content.sd-page-panel-content

How did you find this ID? It looks like it might be a CSS selector, but Jira uses its own naming system for UI components.

Hi Joanna. 

It's the ID I'm getting for the web section showing the customers list in a service desk project. I find it by highlighting it in developer mode:

web section question.png

The problem I'm facing is that I'm trying to hide the customer list here, but it doesn't have a unique ID from what I can tell, because it's not a web element, but a web section.

 

From what I understand, I'll have to create a .js script to hide this, but I'm not sure how to set this up for a specific user. 

Hi Silas,

Thanks for clarifying. In Javascript, you can determine which user is logged in as follows:

JIRA.Users.LoggedInUser.userName()

and use that to decide whether to hide the element.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Apps & Integrations

🍂📹 Apptoberfest demo contest roundup: vote for your favorite demos!

Hi Community! The submissions are in (and listed below) for the 🍻🍂Apptoberfest🍂🍻 Demo Competition and it’s time for you to place your votes for the best: Analytics & reporting app demo ...

237 views 6 16
Read article

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