How to Hide Activities in all Table

hanwar2
Kilo Sage

hanwar2_0-1735273742689.png

 

2 ACCEPTED SOLUTIONS

@hanwar2 

this small script worked for me

Ensure your onLoad client script has Isolate Script = False so that DOM manipulation works.

document.getElementById('sn_form_inline_stream_entries').style.display = 'none'; // to hide

$j('.activity-stream-label-counter').hide();
$j('#activity_field_filter_button').hide();

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

Hi @hanwar2 ,

 

Follow below steps.

  1. Go to form view and right click on header and choose form layout.
  2. Move filtered from left to right and save.
  3. RunjayPatel_0-1735278812831.png

     

I have showcased you for incident similarly you can do it for rest others. its simple.

Hardly you need to for 20-25 tables not more than that.

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------

View solution in original post

12 REPLIES 12

Ankur Bawiskar
Tera Patron
Tera Patron

@hanwar2 

If you wish to do this for specific table then configure the form layout and remove the Activities Filtered from right to left

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@hanwar2 

you will have to do it for individual table and not for all

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Thanks for responding quickly. 

 

I created below onLoad client script as onLoad for Global Table. it is working for Incident, rest I will check

 

function onLoad() {
    console.log("Starting script to enforce hide on Activities section...");

    // Add a CSS rule to force-hide the Activities section
    const style = document.createElement('style');
    style.textContent = `
        .sn-stream {
            display: none !important; /* Force hide */
        }
    `;
    document.head.appendChild(style);
    console.log("CSS rule added to hide Activities section.");

    // Function to check if the Activities section is being re-added dynamically
    function monitorActivities() {
        const activitiesContainer = document.querySelector('.sn-stream');
        if (activitiesContainer && activitiesContainer.style.display !== 'none') {
            console.log("Re-enforcing hide on Activities section...");
            activitiesContainer.style.display = 'none'; // Fallback in case !important is not respected
        }
    }

    // Monitor DOM changes for re-rendering of the Activities section
    const observer = new MutationObserver(() => {
        console.log("DOM mutation detected. Monitoring for Activities section...");
        monitorActivities();
    });

    observer.observe(document.body, {
        childList: true,
        subtree: true
    });
}
 
 
hanwar2_0-1735275053964.png

 

@hanwar2 

this small script worked for me

Ensure your onLoad client script has Isolate Script = False so that DOM manipulation works.

document.getElementById('sn_form_inline_stream_entries').style.display = 'none'; // to hide

$j('.activity-stream-label-counter').hide();
$j('#activity_field_filter_button').hide();

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader