Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security.

Restrict who can see a button added via UI script



I created a button in testrail by using one of the example UI scripts from github. However my issue is that I can’t figure out how to make the button only appear on certain pages (^run/view) and to certain roles (example only admins) at the same time. (I was trying to combine the two in the include information)
At this point I can only make the button appear everywhere for admins or at run/view for everyone.

Is it possible to make the button only appear on run/view and for a certain role?

Thank you & Regards,


It’s very simple. You can get a role of user, so you can add a role verification. Something like this:

if (uiscripts.context.user.role_id != 5) {


Thank you very much :slight_smile: I thought there was a way to make better use of the include phrase, but this works just as well