Conditionally preventing images from showing up in the activity log

Anthony10
Giga Contributor

I'm currently trying to prevent image attachments from appearing as thumbnails in the activity log.

The thumbnails should be visible when the image is attached, but after a certain field on the form is toggled, a user should no longer be able to see the thumbnails in the activity log. The user should still be able to view the attachments from the attachment related list or the list located in the header, I'm just trying to prevent that thumbnail from appearing.

I thought that all of the records in the activity log were stored in the sys_history_line table, but it seems that attachments don't show up there?

1 ACCEPTED SOLUTION

Anthony10
Giga Contributor

I found a solution. Originally I wanted to do this in a UI Macro/Formatter, but it kept breaking our form page.

I created an onLoad client script that finds the HTML elements on the page that display the thumbnail images. I then hide those elements, if certain conditions are met, and add a line of text in their place that notifies the user that the thumbnail was hidden.

It seems to work well enough.

View solution in original post

6 REPLIES 6

Sharath Chandra
ServiceNow Employee
ServiceNow Employee

Hi Anthony,

You can refer to the below documentation on how to configure the list of fields displayed in Activity stream. 

 

https://docs.servicenow.com/bundle/newyork-platform-administration/page/administer/form-administrati...

You can uncheck "Attachments" and you will not see the attachments appearing in the activity stream any more.

Regards,

Sharath

So, if I were to do that, it would hide the attachment thumbnails for all cases. I'd like to conditionally hide them for specific cases.

Anthony10
Giga Contributor

I found a solution. Originally I wanted to do this in a UI Macro/Formatter, but it kept breaking our form page.

I created an onLoad client script that finds the HTML elements on the page that display the thumbnail images. I then hide those elements, if certain conditions are met, and add a line of text in their place that notifies the user that the thumbnail was hidden.

It seems to work well enough.

I have faced the same problem when we attach any png/jpg images, in the activity thumbnail images preview now shown. But when we click on thumbnail it is opened new tab and the image is shown.

find_real_file.png

 

could you please help me how to resolve this issue? you said about if we write on load client script we can resolve it. if yes could you please share the code for the same.

 

Thanks,

Vinoth R