How to hide attachment icon in portal when the ticket is in closed state
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2021 12:58 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2021 03:48 AM
Hope you are doing good.
Did my reply answer your question?
If so, please mark appropriate response as correct & helpful so that the question will appear as resolved for others who may have a similar question in the future.
Thanks!
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2021 11:04 PM
Hope you are doing good.
Did my reply answer your question?
If so, please mark appropriate response as correct & helpful so that the question will appear as resolved for others who may have a similar question in the future.
Thanks!
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2021 05:15 AM
Hi!
I tried this solution, this does not work for me. Can you help? What can I be doing wrong?
Regards
Richa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2022 10:01 AM
Not sure what release everyone is running on, but I had a similar requirement and found a quick fix. You will need to clone both the Ticket Attachments and Ticket Conversations widgets.
For the Ticket Conversations widget, you need only to modify line 134 of the Server script:
function userCanAttach(originalRecord) { //133
if (!gs.hasRole(gs.getProperty("glide.attachment.role")) || (originalRecord.active == false)) //134
return false; //135
For the Ticket Attachments widget, you'll need to add the following to line 31 of the Server script:
data.canWrite = gr.canWrite(); //line 29
data.canAttach = gs.hasRole(gs.getProperty("glide.attachment.role")) && GlideTableDescriptor.get(data.table).getED().getAttribute("no_attachment") != "true"; //line 30
data.recordIsActive = gr.active == true; //line 31 - Add this line
data.canRead = gr.canRead(); //line 32
And modify line 6 of the HTML code:
<div class="panel-heading padder-b-none">
<h2 class="h4 sp-attachments-header panel-title pull-left">
${Attachments}
</h2>
<div ng-if="::(data.canWrite && data.canAttach && data.recordIsActive)"> <!-- Modify this line -->
<sp-attachment-button></sp-attachment-button>
</div>
<div class="clearfix"></div>
</div>
Make sure that you replace the OOB widgets with your newly cloned widgets before testing and you should be good to go!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2022 03:02 PM
this worked for me, thanks for saving me some time!