AnsweredAssumed Answered

script steps to create new record

Question asked by KBGF75 on Aug 10, 2009
Latest reply on Aug 12, 2009 by KBGF75


script steps to create new record


I need help with design of a script to create a new record in another table.


My FMP9 file includes a table of Contacts and a table of Donations.  Donation records are related to the donor‘s Contact record by contactID fields (a Donation record’s contactID_fk will always match the Contact record’s contactID_pk).  A portal in a Contacts layout shows selected fields of related Donations records.


When a new Donations record is created, its contactID_fk field is filled by auto-enter as a calculated value: contactID_fk = Contacts::contactID_pk. This works ok when the new record is created while the user is in the Contacts table: my procedure is just to start entering data in a blank row of the portal.


I would prefer a different procedure. I want to initiate a new Donations record by pressing a button on a Contacts layout. The script step New Record/Request seems an obvious starting point, but first I think I must go to the Donations table.  How to fill the new record’s contactID_fk field probably is trivial, but it has me stumped. Conceptually, I think I should first copy the contactID_pk field of the Contact record, then initiate the new Donations record, then paste the copied value into the new contactID_fk field. What script steps will do this?