Replicating the Manage Attachments Pop-up UI Action

Volente_
Kilo Expert

Hi SN Community, 

I had a business requirement to be able to forward attachments on a record (custom built application) to another system. Due to this alternate system's set up, SN had to send the attachments in the form of an email to this system, lets call it System X. 

The general design flow to achieve this requirement was: 

find_real_file.png

I created a UI Action to place a button on the form called "X Forward". The UI action script performs some auto-set functions on the form and also triggers an event, which then triggers a notification to be sent. The notification has the include attachments box selected. The button works perfectly, but I have recently received an enhancement request asking to have the ability to select which attachments get forwarded vs everything on the record.

What I would like to do (if possible) is to mimic the functionality of the attachment UI action when the X Forward Button is clicked: 

find_real_file.png

I am trying to leverage the UI page "Attachments" (did an insert and stay) and use of GlideDialogWindow within a function, running in the UI Action, but not quite getting it to work. I would appreciate any advice on whether I am on the right track or any alternate suggestions/solutions. Thanks in advance! 

6 REPLIES 6

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Volente,

If you are using out of box include attachment functionality in email then it would add all attachments present for that record. Do you know which attachments to be removed.

you can use before insert business rule on sys_email table and check and remove unnecessary attachment from that email record so before sending it will remove those attachments. I haven't tried this. you need to try this.

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

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

Hi Ankur, 

 

Thank you so very much for taking the time to respond! Yes, that is correct, I am currently using the OOB include attachments, so it is including everything on the record. The user will not always be removing the same type of attachment, however, so there is no consistent criteria. The ask is more directed at having the choice of which attachments to forward aka include on the notification that is triggered. 

So if they have a, b and c attached to the record they want the ability to say all three should remain on the record, but only a and b should be "forwarded" to that other system. So unfortunately I do not believe a business rule to remove the attachment prior to triggering the notification would work. I am looking for a way to provide the user with the ability to select from the list of attachments already on the record (visible in a popup in my mock design), which particular ones should be "forwarded" via the "X Forward" button which is truly just acting as a trigger for a notification that would include that "selection". 

My theory I am working on piecing together is: 

To use a UI page to structure the layout of the popup window, then use the GlideDialogWindow called within a function, that would be within the UI action script (in order to render the pop up window). Once that is working, I would have to figure out how to then label these "selections" and where to store them, so that they can then be retrieved and placed on the notification via an email script that can be called in the notification. 

That is just a theory that I am actively trying to get to work! I would appreciate any insight into getting it working. Thanks again for responding! 

 

Warm regards,

Volente'

Hi Volente,

I appreciate that you have thought of some approach and have started working on that, but that seems to be very much customization and need to be considered if any thing breaks while upgrade etc

I will provide an input if I find some other approach

Regards

Ankur

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

Hi Volente,

Any update on this?

Regards

Ankur

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