How to hide attachment icon in portal when the ticket is in closed state

sangz
Kilo Contributor

Hi,

I have one requirement in which I need to hide the attachment icon from portal when the ticket is in closed complete/ closed cancelled/ Review state.

I tried client script but that is working in native UI not in portal.

Please help to complete this requirement

Thanks

 

16 REPLIES 16

Ash10Patil
Kilo Guru

Hi,

 

You can refer this post:

https://community.servicenow.com/community?id=community_article&sys_id=aff2e9ccdbc17300d82ffb24399619fa

In client script make sure to select UI Type as "Mobile/Service Portal".

Thanks.

sangz
Kilo Contributor

Thanks Asha for response.

I have tried this as well .This code is working in back end view but non in service portal.

Any help is appreciated.

 

Thanks

I have tried below code for OOTB service portal page with id=form, incident record, and it is working for me.

var attachmentButton = top.document.getElementsByTagName('sp-attachment-button');
attachmentButton[0].parentNode.hidden = true;

 

You can add additional conditions as per your requirement.

Send screenshot of both client script and portal page, so that it will be easy to understand. Also, check for browser logs if anything breaking in your client script.

 

Thanks.

sangz
Kilo Contributor

Hi Asha,

 

I just want to remove the attachment icon from the portal only when the sate of the tickets are in Review/closed Cancelled/ Closed complete State

 

find_real_file.png

find_real_file.png