Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How it's possible to remove click on report ?

Maxime Noah
Tera Contributor

Hello !

I'm using the widget report on my service portal.

I can display report but i want remove/disable the click on the report to avoid to display record. Just like a simple report/graph. I'm searching the solution since a moment but doesn't find a solution...

The report before the click :

find_real_file.png

 

The record display after the click :

 

find_real_file.png

Can you help me ?

 

Thx in advance !

1 ACCEPTED SOLUTION

Hi @Maxime Noah ,

 

You can fetch the current user's role in the server script and store it in a variable that can be used in the HTML body to conditionally render the main report widget. Add a "class" in each of the div holding the report and then apply CSS based on that class.

In server sidde code, you can try using below code:

data.result = false;

if (gs.hasRole("itil")){ 

data.result= true;

}

then use it in HTML script like:

<div ng-if=data.result class="itilReports"> //Here you can add a class in the div and then apply the CSS on this class to enable pointer event

<!-- Try adding the report widget main content here -->

</div>

<div ng-if=!data.result class="otherReport"> //Here you can add a class in the div and then apply the CSS on this class to disable pointer event

<!-- Try adding the report widget  main content here -->

</div>

 

Please mark my answer as helpful or correct if it helped you in any way.

Thanks & Regards,

Aishwarya

View solution in original post

6 REPLIES 6

Aishwarya Thaku
Tera Expert

Hi @Maxime Noah ,

 

In your report widget, try using below code in CSS section -

.report_content {
    pointer-events: none;
}

 

Please mark my answer as helpful or correct if it helped you in any way.

Thanks & Regards,

Aishwarya

 

Maxime Noah
Tera Contributor

Hi @Aishwarya Thakur,

 

The solution is great ! It's work !!

 

So, just one more question about that :

 

It's possible to do the same but just remove for specific role (eg : ess) or just authorize for specific role (eg : itil)

 

Thx a lot in advance !

Hi @Maxime Noah ,

 

You can fetch the current user's role in the server script and store it in a variable that can be used in the HTML body to conditionally render the main report widget. Add a "class" in each of the div holding the report and then apply CSS based on that class.

In server sidde code, you can try using below code:

data.result = false;

if (gs.hasRole("itil")){ 

data.result= true;

}

then use it in HTML script like:

<div ng-if=data.result class="itilReports"> //Here you can add a class in the div and then apply the CSS on this class to enable pointer event

<!-- Try adding the report widget main content here -->

</div>

<div ng-if=!data.result class="otherReport"> //Here you can add a class in the div and then apply the CSS on this class to disable pointer event

<!-- Try adding the report widget  main content here -->

</div>

 

Please mark my answer as helpful or correct if it helped you in any way.

Thanks & Regards,

Aishwarya

Hi @Maxime Noah ,

 

Did it resolve your issue?

 

Please mark my answers as helpful or correct if they helped you in any way.

Thanks & Regards,

Aishwarya