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

sangz
Kilo Contributor

Hi Asha,

Could you please send the screenshot of your client script?

Hi,

 

This is different page, I was referring different page. Best way can be you can apply ACL to remove write access(as per your requirement) so that user will not be able to see attachment section and eventually will not be able to add any attachments.

Else you need to modify cloned Ticket attachment and Ticket Conversations widget according to your requirement.

 

Thanks.

Ankur Bawiskar
Tera Patron
Tera Patron

@sangz 

do you want to hide for form page or ticket page

Regards
Ankur

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

Hi Ankur,

Want to hide in both the pages.

Thanks,

@sangz 

you can try to use ACL on incident table for example

So modify/create new Delete and Write ACL on that table with condition for your table and check state there

If that doesn't work then check below

for form page you can do this

1) onLoad client script on whatever table

a) check the state and use this code to remove that icon

function onLoad(){

	var checkValue = g_form.getDisplayBox('state').value;
	if (checkValue == "Closed"){
		var attachmentButton = top.document.getElementsByTagName('sp-attachment-button');
		attachmentButton[0].parentNode.hidden = true;
	}
}

for ticket page you need to do this

1) clone the ticket attachments widget

2) in your newly cloned widget follow this steps

https://community.servicenow.com/community?id=community_question&sys_id=e4f52789dbb967402737e15b8a96...

Regards
Ankur

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