Author Topic: Group Records  (Read 2916 times)

Melinda DePalma

  • Member
  • *
  • Posts: 179
    • Productive Computing
Group Records
« on: May 21, 2009, 10:23:00 AM »
You can  create a new group by using the PCAB_New( Type ) function whereas the type  specifies the type of record to create. The type is either “Person” or “Group”. You can also create a new subgroup by using the PCAB_AddSubGroup( Address Book ID ).

When handling groups, the script needs to open the group record and then add contacts to the specified group.  To open the Group record you will need to locate it using the PCAB_Search function.  Eg: PCAB_Search( "Group" ; "Name" ; "" ; "" ; "GroupName" ; "Equal" ). This will find the group with the name "GroupName". The search will return the number of records found that match the search criteria. The scripts use the PCAB_OpenFirstRecord function to get the Address Book ID of the record. Then with the Group record opened use the PCAB_AddPerson function to add contacts to the group and done!

Since a FileMaker demo of how to add a new contact to an existing group is not currently available, please allow me to provide you with the general steps with a practical example below:

1) Locate and open the desired group using the PCAB_Search function. In this example our group name will be called "Sales"

PCAB_Search( "Group" ; "Name" ; "" ; "" ; "Sales" ; "Equal" ). The search will return the number of records found that match the search criteria.

2) Open the desired group record using PCAB_OpenFirstRecord. This function opens the first record in the found set from the previous call to PCAB_Search.

3) Add new contact record to the Sales group by using PCAB_AddPerson.
The new contact record will automatically be added to the currently opened group.

4) Save the record using PCAB_Save


Script will look something like this:
PCAB_Search( "Group" ; "Name" ; "" ; "" ; "Sales" ; "Equal" )
PCAB_OpenFirstRecord
PCAB_AddPerson
PCAB_Save