Need to hide add documents button present in employee center in every catalog item .

Shivangi Singh2
Tera Contributor

Hi Experts,

 

I need your help in making "Add Documents" button disabled for a catalog item .

Condition is , when type == value then 'add documents' should be hidden from the emp center catalog frontend page ,but for types it should be visible .

Added the image of the button and html format .

It's little urgent, will be glad having any help.

Below is the code for hiding the button which i tried but didn't worked:

 

"function hideAttachmentButton() {

        var attachmentButton = this.document.getElementsByClassName('attachment-text');

        alert(attachmentButton);

        attachmentButton.style.display = 'none';

    }

}"

object value is getting alert too but button is not hiding.

 

Any help will be appreciated. Thanks!

ShivangiSingh2_1-1750355639737.png

 

ShivangiSingh2_0-1750355572493.png

 

3 REPLIES 3

Community Alums
Not applicable

Hi @Shivangi Singh2 ,

Use ng-if or ng-show (Recommended for ServiceNow UI)
Since Employee Center uses AngularJS, the cleanest way is to modify the widget’s HTML to conditionally hide the button.

 

<span ng-if="c.data.type != 'value_to_hide'" ng-class="{'attachment-text': options.native_mobile == 'true'}" aria-hidden="true">
  Attach documents
</span>

 Replace value_to_hide with the catalog item type where the button should disappear.

Hi Tejas, 

Can you provide the code in client script format instead of portal

Ankur Bawiskar
Tera Patron
Tera Patron

@Shivangi Singh2 

this is for which portal page? share complete screenshots.

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