Multiple Contacts - Multiple Appt Details
Posted:
Tue Dec 08, 2009 4:59 pm
by Marvin
Hi John,
In our database we allow multiple Contacts to be assigned to a single appointment. That generates multiple ContactID's in the ApptContactID_kf field.
I would like to be able to print out a different Appointment Detail layout for each of the ApptContactID_kf's stored in that field (one print out based on the first ContactID, one for the second, etc.).
I am struggling with the script steps to be added to the PrintContact(action) script that would handle that type of request.
Thanks.
Marvin
Posted:
Tue Dec 08, 2009 5:01 pm
by John Sindelar
When you say "different" do you mean with contact no1's details on the first print out, contact no2's details on the second, etc.? Or do you mean one copy of the same layout content for each contact?
Posted:
Wed Dec 09, 2009 9:02 am
by Marvin
Yes to the first, with 1st contacts details on the first print out and 2nd contacts details on the second, etc.
Marvin
Posted:
Thu Dec 10, 2009 9:28 am
by John Sindelar
Hi Marvin,
So no good answers here. Keeping multiple contact IDs in the appointment record works (and is something you'll want to keep doing even if also use a join table as suggested below), but it has some limitations, especially when it comes to printing.
In the architecture you have now you can print the appointment or GTRR and print the appointments contacts. Printing from the contacts *can* get you what you want, but it involves a hack: you'd need to create a new global field in contacts to hold the ID of the appointment you wish to print (and a relationship from there back to a new instance of appointments), then create a new print layout in contacts which combines details from the contacts' record with details from the related appointments represented by that new global field.
That works, but what is a little more natural (and more flexible) is to create new records in a join table for each contact linked to an appointment. This join table needs just two fields--one for the contact ID and one for the appointment ID-- but it could have more, such as fields for that contact's *role* in the appointment. I'm sure you can see how you could GTRR to this join table and print for each contact on an appointment easily.
The trick is how to make the join records and I'd make the join records at the end of the "Edit Appointment - Choose Contact" script. Don't forget you'll want to continue to maintain the ApptContactID_kf field so that you can, for instance, filter the calendar by contact.
I hope that helps.