Select All button for removing attachments

jean-pauldehaas
Tera Guru

Hi,

i`m looking for a way to add a button to the attachment pane called Select all, we already have a download all button but i am not able to find hwo to add this select all button:

find_real_file.png

 

4 REPLIES 4

shloke04
Kilo Patron

Hi @jean-paul.dehaas 

Technically it may be possible and you may be able to do it as well. My suggestion will be DO NOT CUSTOMIZE THIS AS THIS UI PAGE IS USED ACROSS THE PLATFORM AN MAY CAUSE ISSUE IN FUTURE.

I would suggest not to implement or customize this.

For reference posting the UI Page link below:

https://instance.service-now.com/nav_to.do?uri=sys_ui_page.do?sys_id=b1b390890a0a0b1e00f6ae8a31ee2697

Replace "instance' with your instance name.

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

shloke04
Kilo Patron

Hi @jean-paul.dehaas 

Please let me know if you have any further query else please mark the answer as correct and close this thread for others.

Regards,

Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

shloke04
Kilo Patron

@jean-paul.dehaas 

Was thinking about your requirement on what can be an alternative option and my suggestion will be as below:

1) Create a Button on the Table you want where you want to have an ability to remove all attachment.

2) Navigate to UI action module and create it as shown below. Make sure to check the Form button checkbox as true and use the code as below:

Using a button will give you an advantage to control whom this button should be visible to by updating the condition field in UI Action. If you want to have this functionality for all users then leave it as blank.

removeAttachment();
function removeAttachment(){
	var gr = new GlideRecord('sys_attachment');
	gr.addQuery('table_name',current.sys_class_name);
	gr.addQuery('table_sys_id',current.sys_id);
	gr.query();
	while(gr.next()){
		gr.deleteRecord();
	}
}

 UI Action screenshot:

find_real_file.png

Result:

This works for me. This can be an alternative approach instead of customizing the global UI Page which is not a recommended approach.

find_real_file.png

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

shloke04
Kilo Patron

@jean-paul.dehaas 

If you have a follow up query then do let me know else if your query is resolved then please mark the answer as correct and close this thread for others.

Regards,

Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke