How to add an attachment in Glide Dialog window?

d_kush
Giga Contributor

Hi All,

I have a requirement. I am calling a custom UI page through GlideWindow API using UI action on form .

I want to add add attachments to the form as well using same GlideWindow.

I am new to UI page creation . Need suggestions how to add an attachment box in the UI page and then how to process the attached file.

I can see their is an OOB attachment page, can it be utilized? and If yes then how?

All suggestions are welcomed..

8 REPLIES 8

Kannan Nadar
Tera Guru

Hi Deepti,



If your requirement is only to add attachment, why not use the normal attachment paper clip icon? If you really want to use the OOB UI Page, you can use the code below in your UI Action.



function add_attachment()


{


var gdw = new GlideDialogWindow('attachment');


gdw.setPreference('target_sys_id', g_form.getUniqueValue());


gdw.setPreference('target_table', g_form.getTableName());


gdw.setPreference('attachment_disabled', false);


gdw.render();


}


I need to add some more fields including attachment because of which I am not able to use attachment paper clip.


Ok then you can copy the OOB attachment code and its client script and use that in your custom UI Page. It should work fine. But make sure you are passing the below parameters from your UI Action.



gdw.setPreference('target_sys_id', g_form.getUniqueValue());


gdw.setPreference('target_table', g_form.getTableName());


gdw.setPreference('attachment_disabled', false);


I am able to merge both of the UI pages now attachment is working fine.


Next step is to send those attachments in Email Notification , I am able to do that as well. But it is sending all the attachments added to that record.


Is this any way to send selective attachments in email notification.