Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

MBS FileMaker Plugin Example Databases

Contacts

All examples are included with download of MBS FileMaker Plugin.

Contacts.fmp12

Overview
Tables 1
Relationships 0
Layouts 1
Scripts 11
Value Lists 0
Custom Functions 0
Custom Menus 24
File Options
Default custom menu set [Standard FileMaker Menus]
Default theme Apex Blue
When opening file
Minimum allowed version 12.0
Login using Account Name; Account= Admin
Allow user to save password Off
Require iOS passcode Off
Show Sign-in fields Off
Switch to layout Off
Hide all toolbars Off
Script triggers
OnFirstWindowOpen Off
OnLastWindowClose Off
OnWindowOpen Off
OnWindowClose Off
OnFileAVPlayerChange Off
OnWindowTransaction Off
Thumbnail Settings
Generate Thumbnails On; Temporary

 

Tables

Table Name
Statistics
Comments
Occurrences in Relationship Graph
Contacts
3 fields defined, 1 record
Contacts

Fields

Table Name: Contacts - 3 Fields
Field Name Type Options Comments On Layouts In Relationships In Scripts In Value Lists
Result Normal, Text Auto-Enter:
  • Allow editing
Validation:
  • Only during data entry
Storage:
  • Repetitions: 1
  • Indexing: None
  • Automatically create indexes as needed
  • Index Language: German
      GroupID Normal, Text Auto-Enter:
      • Allow editing
      Validation:
      • Only during data entry
      Storage:
      • Repetitions: 1
      • Indexing: None
      • Automatically create indexes as needed
      • Index Language: German
          ContactID Normal, Text Auto-Enter:
          • Allow editing
          Validation:
          • Only during data entry
          Storage:
          • Repetitions: 1
          • Indexing: None
          • Automatically create indexes as needed
          • Index Language: German

              Layout Objects: Contacts

              Regular Fields

              Field Name: Contacts::Result
              Field Properties Coordinates Field Format Field Behavior Quick Find
              • Top: 52 pt
              • Left: 8 pt
              • Bottom: 525 pt
              • Right: 526 pt
              • Anchoring: Left, Top
              Field Format:
              • Edit Box
              Field Behavior:
              • Allow field to be entered: In Find mode, In Browse mode
              • Touch keyboard type: Default for Data Type
              • Go to next field using: Tab key
              Yes

              Field Name: Contacts::GroupID
              Field Properties Coordinates Field Format Field Behavior Quick Find
              • Top: 527 pt
              • Left: 138 pt
              • Bottom: 548 pt
              • Right: 526 pt
              • Anchoring: Left, Top
              Field Format:
              • Edit Box
              Field Behavior:
              • Allow field to be entered: In Find mode, In Browse mode
              • Touch keyboard type: Default for Data Type
              • Go to next field using: Tab key
              Yes

              Field Name: Contacts::ContactID
              Field Properties Coordinates Field Format Field Behavior Quick Find
              • Top: 550 pt
              • Left: 138 pt
              • Bottom: 571 pt
              • Right: 526 pt
              • Anchoring: Left, Top
              Field Format:
              • Edit Box
              Field Behavior:
              • Allow field to be entered: In Find mode, In Browse mode
              • Touch keyboard type: Default for Data Type
              • Go to next field using: Tab key
              Yes

              Buttons

              Button Properties Coordinates Script/Script Step
                Type:
              • Text: Check Status
              • Top: 58 pt
              • Left: 539 pt
              • Bottom: 90 pt
              • Right: 687 pt
              • Anchoring: Left, Top
              Perform Script [ “Check Authorization Status” ]

              Scripts:


              Button Properties Coordinates Script/Script Step
                Type:
              • Text: Request Authorization
              • Top: 58 pt
              • Left: 700 pt
              • Bottom: 90 pt
              • Right: 848 pt
              • Anchoring: Left, Top
              Perform Script [ “Request Authorization” ]

              Scripts:


              Button Properties Coordinates Script/Script Step
                Type:
              • Text: Query me as JSON
              • Top: 103 pt
              • Left: 539 pt
              • Bottom: 135 pt
              • Right: 687 pt
              • Anchoring: Left, Top
              Perform Script [ “Query Me as JSON” ]

              Scripts:


              Button Properties Coordinates Script/Script Step
                Type:
              • Text: List Groups
              • Top: 103 pt
              • Left: 700 pt
              • Bottom: 135 pt
              • Right: 848 pt
              • Anchoring: Left, Top
              Perform Script [ “List Groups” ]

              Scripts:


              Button Properties Coordinates Script/Script Step
                Type:
              • Text: Create Group
              • Top: 148 pt
              • Left: 539 pt
              • Bottom: 180 pt
              • Right: 687 pt
              • Anchoring: Left, Top
              Perform Script [ “Create Group” ]

              Scripts:


              Button Properties Coordinates Script/Script Step
                Type:
              • Text: Delete Group
              • Top: 148 pt
              • Left: 700 pt
              • Bottom: 180 pt
              • Right: 848 pt
              • Anchoring: Left, Top
              Perform Script [ “Delete Group” ]

              Scripts:


              Button Properties Coordinates Script/Script Step
                Type:
              • Text: Create Contact
              • Top: 193 pt
              • Left: 539 pt
              • Bottom: 225 pt
              • Right: 687 pt
              • Anchoring: Left, Top
              Perform Script [ “Create Contact” ]

              Scripts:


              Button Properties Coordinates Script/Script Step
                Type:
              • Text: Delete Contact
              • Top: 193 pt
              • Left: 700 pt
              • Bottom: 225 pt
              • Right: 848 pt
              • Anchoring: Left, Top
              Perform Script [ “Delete Contact” ]

              Scripts:


              Button Properties Coordinates Script/Script Step
                Type:
              • Text: Show Contact
              • Top: 238 pt
              • Left: 539 pt
              • Bottom: 270 pt
              • Right: 687 pt
              • Anchoring: Left, Top
              Perform Script [ “Show Contact” ]

              Scripts:


              Button Properties Coordinates Script/Script Step
                Type:
              • Text: Set Trigger
              • Top: 238 pt
              • Left: 700 pt
              • Bottom: 270 pt
              • Right: 848 pt
              • Anchoring: Left, Top
              Perform Script [ “Set Trigger” ]

              Scripts:


              Script Hierarchy

              Check Authorization Status
              Query Me as JSON
              List Groups
              Request Authorization
              Create Group
              Create Contact
              Show Contact
              Set Trigger
              Trigger
              Delete Group
              Delete Contact

              Next Script: [Query Me as JSON]
              Script Name Check Authorization Status
              Run script with full access privileges Off
              Siri Shortcut Visible Off
              Include In Menu No
              Layouts that use this script
              Scripts that use this script
                Script Definition
                Script Steps
                Fields used in this script
                  Scripts used in this script
                    Layouts used in this script
                      Tables used in this script
                        Table occurrences used by this script
                          Custom Functions used by this script
                            Custom menu set used by this script

                              Previous Script: [Check Authorization Status] Next Script: [List Groups]
                              Script Name Query Me as JSON
                              Run script with full access privileges Off
                              Siri Shortcut Visible Off
                              Include In Menu No
                              Layouts that use this script
                              Scripts that use this script
                                Script Definition
                                Script Steps
                                Fields used in this script
                                Scripts used in this script
                                  Layouts used in this script
                                    Tables used in this script
                                    Table occurrences used by this script
                                    Custom Functions used by this script
                                      Custom menu set used by this script

                                        Previous Script: [Query Me as JSON] Next Script: [Request Authorization]
                                        Script Name List Groups
                                        Run script with full access privileges Off
                                        Siri Shortcut Visible Off
                                        Include In Menu No
                                        Layouts that use this script
                                        Scripts that use this script
                                          Script Definition
                                          Script Steps
                                          • Set Variable [ $groups; Value:MBS( "CNContactStore.Groups" ) ]
                                          • Set Variable [ $count; Value:ValueCount ( $groups ) ]
                                          • If [ $count > 0 ]
                                          • Set Variable [ $index; Value:1 ]
                                          • Set Variable [ $text; Value:"" ]
                                          • Loop [ Flush: Always ]
                                          • Set Variable [ $groupID; Value:GetValue($groups; $index) ]
                                          • Set Variable [ $groupName; Value:MBS( "CNGroup.Name"; $groupID ) ]
                                          • Set Variable [ $text; Value:$text & $GroupName & " " & $groupID ]
                                          • #next
                                          • Set Variable [ $index; Value:$index + 1 ]
                                          • Exit Loop If [ $index > $count ]
                                          • Set Variable [ $text; Value:$text & ¶ ]
                                          • End Loop
                                          • End If
                                          • Set Field [ Contacts::Result; $text ]
                                          Fields used in this script
                                          Scripts used in this script
                                            Layouts used in this script
                                              Tables used in this script
                                              Table occurrences used by this script
                                              Custom Functions used by this script
                                                Custom menu set used by this script

                                                  Previous Script: [List Groups] Next Script: [Create Group]
                                                  Script Name Request Authorization
                                                  Run script with full access privileges Off
                                                  Siri Shortcut Visible Off
                                                  Include In Menu No
                                                  Layouts that use this script
                                                  Scripts that use this script
                                                    Script Definition
                                                    Script Steps
                                                    • Set Variable [ $r; Value:MBS( "CNContactStore.RequestAccesss" ) ]
                                                    • Pause/Resume Script [ Duration (seconds): 1 ]
                                                    • Set Variable [ $r; Value:MBS( "CNContactStore.AuthorizationError" ) ]
                                                    • If [ Length($r) > 0 ]
                                                    • Show Custom Dialog [ Title: "Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
                                                    • End If
                                                    • Set Variable [ $groups; Value:MBS( "CNContactStore.Groups" ) ]
                                                    • If [ Length ( $groups ) = 0 ]
                                                    • Show Custom Dialog [ Title: "Possible Problem"; Message: "Either you have no groups or you did not code sign the app?"; Default Button: “OK”, Commit: “Yes” ]
                                                    • End If
                                                    Fields used in this script
                                                      Scripts used in this script
                                                        Layouts used in this script
                                                          Tables used in this script
                                                            Table occurrences used by this script
                                                              Custom Functions used by this script
                                                                Custom menu set used by this script

                                                                  Previous Script: [Request Authorization] Next Script: [Create Contact]
                                                                  Script Name Create Group
                                                                  Run script with full access privileges Off
                                                                  Siri Shortcut Visible Off
                                                                  Include In Menu Yes
                                                                  Layouts that use this script
                                                                  Scripts that use this script
                                                                    Script Definition
                                                                    Script Steps
                                                                    • Set Variable [ $r; Value:MBS( "CNContactStore.AddGroup"; "Test Group") ]
                                                                    • If [ MBS("IsError") ]
                                                                    • Show Custom Dialog [ Title: "Failed to create a group"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
                                                                    • Else [ ]
                                                                    • Set Field [ Contacts::GroupID; $r ]
                                                                    • End If
                                                                    Fields used in this script
                                                                    Scripts used in this script
                                                                      Layouts used in this script
                                                                        Tables used in this script
                                                                        Table occurrences used by this script
                                                                        Custom Functions used by this script
                                                                          Custom menu set used by this script

                                                                            Previous Script: [Create Group] Next Script: [Show Contact]
                                                                            Script Name Create Contact
                                                                            Run script with full access privileges Off
                                                                            Siri Shortcut Visible Off
                                                                            Include In Menu No
                                                                            Layouts that use this script
                                                                            Scripts that use this script
                                                                              Script Definition
                                                                              Script Steps
                                                                              • Set Variable [ $contactID; Value:MBS( "CNContactStore.NewContact") ]
                                                                              • Set Variable [ $r; Value:MBS( "CNContact.SetValue"; $contactID; "givenName"; "Joe" ) ]
                                                                              • Set Variable [ $r; Value:MBS( "CNContact.SetValue"; $contactID; "familyName"; "Miller" ) ]
                                                                              • Set Variable [ $r; Value:MBS( "CNContact.SetValue"; $contactID; "jobTitle"; "Family Manager" ) ]
                                                                              • Set Variable [ $r; Value:MBS( "CNContact.SetValue"; $contactID; "organizationName"; "Family" ) ]
                                                                              • Set Variable [ $image; Value:MBS( "Container.ReadFile"; "/Library/Desktop Pictures/Lion.jpg") ]
                                                                              • Set Variable [ $r; Value:MBS( "CNContact.SetValue"; $contactID; "imageData"; $image ) ]
                                                                              • Set Variable [ $r; Value:MBS( "CNContact.AddEmailAddress"; $contactID; "test@test.test"; "Work" ) ]
                                                                              • Set Variable [ $r; Value:MBS( "CNContact.AddInstantMessage"; $contactID; "instantTest"; "Facebook"; "Work" ) ]
                                                                              • Set Variable [ $r; Value:MBS( "CNContact.AddURLAddress"; $contactID; "http://www.monkeybreadsoftware.com/"; "Homepage" ) ]
                                                                              • Set Variable [ $r; Value:MBS( "CNContact.AddSocialProfile"; $contactID; "Home"; "http://www.facebook.com"; "testSocial"; ""; "Facebook" ) ]
                                                                              • Set Variable [ $r; Value:MBS( "CNContact.AddRelation"; $contactID; "Jane Miller"; "Sister" ) ]
                                                                              • Set Variable [ $r; Value:MBS( "CNContact.AddPhoneNumber"; $contactID; "123 456 789"; "iPhone" ) ]
                                                                              • Set Variable [ $r; Value:MBS( "CNContact.AddPostalAddress"; $contactID; "Home"; "Main Street 123"; "New City"; "NS"; "12345"; "USA"; "US" ) ]
                                                                              • Set Variable [ $contactID; Value:MBS( "CNContactStore.AddContact"; $contactID) ]
                                                                              • If [ MBS("IsError") ]
                                                                              • Show Custom Dialog [ Title: "Failed to create a contact"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
                                                                              • Else [ ]
                                                                              • Set Field [ Contacts::ContactID; $contactID ]
                                                                              • Set Variable [ $json; Value:MBS( "CNContact.JSON"; $contactID) ]
                                                                              • Set Variable [ $json; Value:MBS("JSON.Colorize"; MBS( "JSON.Format"; $json) ) ]
                                                                              • Set Field [ Contacts::Result; $json ]
                                                                              • End If
                                                                              Fields used in this script
                                                                              Scripts used in this script
                                                                                Layouts used in this script
                                                                                  Tables used in this script
                                                                                  Table occurrences used by this script
                                                                                  Custom Functions used by this script
                                                                                    Custom menu set used by this script

                                                                                      Previous Script: [Create Contact] Next Script: [Set Trigger]
                                                                                      Script Name Show Contact
                                                                                      Run script with full access privileges Off
                                                                                      Siri Shortcut Visible Off
                                                                                      Include In Menu No
                                                                                      Layouts that use this script
                                                                                      Scripts that use this script
                                                                                        Script Definition
                                                                                        Script Steps
                                                                                        Fields used in this script
                                                                                        Scripts used in this script
                                                                                          Layouts used in this script
                                                                                            Tables used in this script
                                                                                            Table occurrences used by this script
                                                                                            Custom Functions used by this script
                                                                                              Custom menu set used by this script

                                                                                                Previous Script: [Show Contact] Next Script: [Trigger]
                                                                                                Script Name Set Trigger
                                                                                                Run script with full access privileges Off
                                                                                                Siri Shortcut Visible Off
                                                                                                Include In Menu Yes
                                                                                                Layouts that use this script
                                                                                                Scripts that use this script
                                                                                                  Script Definition
                                                                                                  Script Steps
                                                                                                  Fields used in this script
                                                                                                    Scripts used in this script
                                                                                                      Layouts used in this script
                                                                                                        Tables used in this script
                                                                                                          Table occurrences used by this script
                                                                                                            Custom Functions used by this script
                                                                                                              Custom menu set used by this script

                                                                                                                Previous Script: [Set Trigger] Next Script: [Delete Group]
                                                                                                                Script Name Trigger
                                                                                                                Run script with full access privileges Off
                                                                                                                Siri Shortcut Visible Off
                                                                                                                Include In Menu No
                                                                                                                Layouts that use this script
                                                                                                                  Scripts that use this script
                                                                                                                    Script Definition
                                                                                                                    Script Steps
                                                                                                                    • Show Custom Dialog [ Title: "Changes"; Message: "Someone made changes in other application..."; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
                                                                                                                    Fields used in this script
                                                                                                                      Scripts used in this script
                                                                                                                        Layouts used in this script
                                                                                                                          Tables used in this script
                                                                                                                            Table occurrences used by this script
                                                                                                                              Custom Functions used by this script
                                                                                                                                Custom menu set used by this script

                                                                                                                                  Previous Script: [Trigger] Next Script: [Delete Contact]
                                                                                                                                  Script Name Delete Group
                                                                                                                                  Run script with full access privileges Off
                                                                                                                                  Siri Shortcut Visible Off
                                                                                                                                  Include In Menu No
                                                                                                                                  Layouts that use this script
                                                                                                                                  Scripts that use this script
                                                                                                                                    Script Definition
                                                                                                                                    Script Steps
                                                                                                                                    • If [ Length ( Contacts::GroupID ) = 0 ]
                                                                                                                                    • Show Custom Dialog [ Title: "Failed to delete a group"; Message: "No ID in field"; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
                                                                                                                                    • Else [ ]
                                                                                                                                    • Set Variable [ $r; Value:MBS( "CNContactStore.DeleteGroup"; Contacts::GroupID) ]
                                                                                                                                    • If [ MBS("IsError") ]
                                                                                                                                    • Show Custom Dialog [ Title: "Failed to delete a group"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
                                                                                                                                    • Else [ ]
                                                                                                                                    • Set Field [ Contacts::GroupID; "" ]
                                                                                                                                    • End If
                                                                                                                                    • End If
                                                                                                                                    Fields used in this script
                                                                                                                                    Scripts used in this script
                                                                                                                                      Layouts used in this script
                                                                                                                                        Tables used in this script
                                                                                                                                        Table occurrences used by this script
                                                                                                                                        Custom Functions used by this script
                                                                                                                                          Custom menu set used by this script

                                                                                                                                            Previous Script: [Delete Group]
                                                                                                                                            Script Name Delete Contact
                                                                                                                                            Run script with full access privileges Off
                                                                                                                                            Siri Shortcut Visible Off
                                                                                                                                            Include In Menu No
                                                                                                                                            Layouts that use this script
                                                                                                                                            Scripts that use this script
                                                                                                                                              Script Definition
                                                                                                                                              Script Steps
                                                                                                                                              • If [ Length ( Contacts::ContactID ) = 0 ]
                                                                                                                                              • Show Custom Dialog [ Title: "Failed to delete a contact"; Message: "No ID in field"; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
                                                                                                                                              • Else [ ]
                                                                                                                                              • Set Variable [ $r; Value:MBS( "CNContactStore.DeleteContact"; Contacts::ContactID) ]
                                                                                                                                              • If [ MBS("IsError") ]
                                                                                                                                              • Show Custom Dialog [ Title: "Failed to delete a contact"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
                                                                                                                                              • Else [ ]
                                                                                                                                              • Set Field [ Contacts::ContactID; "" ]
                                                                                                                                              • End If
                                                                                                                                              • End If
                                                                                                                                              Fields used in this script
                                                                                                                                              Scripts used in this script
                                                                                                                                                Layouts used in this script
                                                                                                                                                  Tables used in this script
                                                                                                                                                  Table occurrences used by this script
                                                                                                                                                  Custom Functions used by this script
                                                                                                                                                    Custom menu set used by this script

                                                                                                                                                      Download example: Contacts

                                                                                                                                                      Used functions: