Adding an Attachment to Appointments

I've seen various requests for the ability to add attachments to Appointments in CRM, most of which have gone unanswered or left on peoples' wish lists.

We had a similar requirement from our users to be able to do the same thing. I was on the point of giving up myself but thought I would take a look at the button on the Task screen in the DOM.

I noticed the Add attachment button has an onclick event calling some JavaScript which ultimately allows attachments to be added:

So using this onclick event and the Clientside API, I added a new button to the Appointment screen to copy the behaviour of the Add Attachment button:

crm.addButton("..\\Themes/Img/default/Buttons/FileUpload.gif", "Add Attachment", "Add Attachment", {
click: function() {
if((document.EntryForm.DoFollowUpTask != null && document.EntryForm.DoFollowUpTask.checked) || (document.EntryForm.DoFollowUpAppt != null && document.EntryForm.DoFollowUpAppt.checked) || ((document.EntryForm.DoFollowUpOpp) && (document.EntryForm.DoFollowUpOpp.checked))) {
alert('Cannot add an attachment when follow up option is checked.');
}
else if (SageCRM.webTriPage.formChanged(document.EntryForm)) {
if (confirm('You need to save the Appointment before you can add attachments. Save now?')) {
document.getElementById('HNA').value = 340;
document.EntryForm.submit();
}
}
else {
alert('Cannot add an attachment to a new, unsaved communication. Communication must contain details.')
}
}
});

Upon clicking the button , I found that I was able to add an attachment to an Appointment once it had been saved, similar to Tasks. An icon was then added (automatically by CRM?) to the Appointment to show that it had an attachment.

Thought I would share this as a potential solution for others wanting to add attachments to Appointments.