Create Events

Can I make event records from outside the calendar, such as from portals on my other layouts?

Absolutely. In fact, you'll see that we do this on the Contacts layout where we have a "new event" button towards the lower right. That button calls one of the scripts in the calendar specifically set up to receive commands from your other layouts (or even other files).

The script is called "Create Edit Delete Event ( SourceNo ) { Operation , DateStart , DateEnd , TimeStart , Resource... }" and it can take any number of parameters to let you manipulate events using your own scripts.

In our script from the Contacts' record we send the following parameters to create a new record for the contact we're looking at:

"SourceNo = 1 ; Operation = Create ; ContactID = " & Contacts::_id & " ; DateStart = " & Get ( CurrentDate ) & If ( Interface::ShowMilestonesGlob = "Milestones" ; " ; isMilestone = 1" ; "" )

Read the comments at the beginning of this script to learn about other parameters you can send to this script.

What about editing events?

You can edit events the same way, read about the "Operation" parameter at the beginning of this script to see how you can have it edit a record as well as create one.

Can I extend this script to take new parameters?

Of course! Just as you're likely adding new fields to the events table (If you're a doctor, you may add a field for "symptoms", for example), you'll likely want to add those new fields to this script in the form of new parameters. Here's how, taking "symptoms" as an example:

First, define a new field in your events table for the parameter, in our example the field would be "Symptoms".
Now edit the comments at the beginning (the head) of the script "Create Edit Delete Event ( Sou.." and add a new line describing your new parameter. You don't need to add the parameter to the script name as there is no longer room.
The script will automatically create new local variables for your new parameter, providing it is sent in the actual script parameter.
Find the comment "Unmapped fields specific to Source 1 follow" and duplicate one of the three line blocks that follow, for example duplicate these three lines:
If [ not isempty ( $sc_Status )]
Set Field [ CalendarEvents::Status; $sc_Status]
End if
And turn them in to this ("Symptom" is our example here):
If [ not isempty ( $sc_Symptom )]
Set Field [ CalendarEvents::Symptom; $sc_Symptom ]
End if
That's it. Do this for as many new parameters as you may need.

Bring up an event for the user to see.

As with creating events, we have a simple script you can use to show an event as well. This is much easier than try to write a GoToRelatedRecord statement each time you'd like to view an event (and managing the window state in that GTRR, etc.)

Pass the event's ID into the script "Show Events Details ( SourceNo ; ID ; DateStart )" following the instructions at the beginning of the script. In SeedCode Complete your SourceNo will always be "1" unless you've created multiple sources.

Follow us: