< I've moved this from custom functions to general support. >
In most cases, I think you'll want to be entering the donation from the context of the donor's record. That is, you'll be "on" the donor record or will have "selected" the donor record (see my answer to your other post). The point here is that FileMaker needs some context in which to know
which donor you intend to use for the donation. Once you have that context, you'd use it to record the donor's ID in the first SetVariable script step below. (This is just an example script showing how you might create a new donation in a new window from the donor's layout.)
- Code: Select all
#
#Record the Unique ID of the donor we wish to create a donation for.
#
Set Variable [ $Donor; Value:Donors::Donor ID ]
#
#Navigate to a layout based on the donations table so that we can create a new donation record.
#
Allow User Abort [ Off ]
New Window [ Name: "New Donation"; Top: Get ( WindowTop ) + 40; Left: Get ( WindowLeft ) + 40 ]
Go to Layout [ “Donation Form” (Donation) ]
Show/Hide Status Area
[ Lock; Hide ]
Adjust Window
[ Resize to Fit ]
#
#Create the new record, linking it to our donor.
#
New Record/Request
Set Field [ Donation::Donor ID; $Donor ]
#
#Pause at this layout, allowing the user to edit the donation.
#
Allow User Abort [ Off ]
Pause/Resume Script [ Indefinitely ]
#
#Upon resume script, close window, returning focus to original layout.
#
Close Window [ Current Window ]