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

Calendar.SaveReminder

Saves the reminder.

Component Version macOS Windows Linux Server iOS SDK
Calendar 3.4 ✅ Yes ❌ No ❌ No ❌ No ❌ No
MBS( "Calendar.SaveReminder"; reminderRef )   More

Parameters

Parameter Description Example
reminderRef The id of the reminder to query. $reminderRef

Result

Returns OK or error.

Description

Saves the reminder.

Examples

Synchronize Todos with Reminders:

# Sync ToDos as Reminders from FileMaker to Mac Reminder app
# And sync back changes

# Please adjust to your fields and your special use case!
# You can optimize to only update fields on each side if changed
#

Go to Record/Request/Page [First]
Loop
    # Check if we have an ID for this todo already
    If [ToDos::SyncUID  ≠ ""]
        Set Variable [$c; Value:ToDos::SyncUID]
        #Query last modification date
        Set Variable [$completed; Value:MBS( "Calendar.Item.GetCompleted"; ToDos::SyncUID )]
        Set Variable [$datum; Value:MBS( "Calendar.Item.GetDateStamp"; ToDos::SyncUID )]
        If [MBS("isError")]
            # Reminder was deleted, so we recreate
            Set Field [ToDos::SyncUID; ""]
            Commit Records/Requests [No dialog]
        Else
            #Update
            If [$datum > ToDos::Last_Change]
                #
                #Reminder -> FM
                #
                #Sync note field
                Set Variable [$notes; Value:MBS( "Calendar.Item.GetNotes"; ToDos::SyncUID )]
                If [ToDos::To Do Main Text  ≠ $notes]
                    #Special: If note starts with # then move number to duration field
                    If [Left ( Trim ( $notes ); 1) = "#"]
                        Set Variable [$duration; Value:GetAsNumber ( LeftWords ( $notes ; 1 ))]
                        Set Field [ToDos::To Do Completion Time in Minutes; $duration]
                        Commit Records/Requests [No dialog]
                    Else
                        Set Field [ToDos::To Do Main Text; $notes]
                        Commit Records/Requests [No dialog]
                    End If
                End If
                #Sync title if changed
                Set Variable [$title; Value:MBS( "Calendar.Item.GetTitle"; ToDos::SyncUID )]
                If [ToDos::To Do Headline  ≠ $title]
                    Set Field [ToDos::To Do Headline; $title]
                    Commit Records/Requests [No dialog]
                End If
                #Sync completed flag if changed
                If [$completed=1]
                    If [ToDos::flag To Do Completed  ≠ "X"]
                        Set Field [ToDos::flag To Do Completed; "X"]
                        Commit Records/Requests [No dialog]
                    End If
                Else If [$completed=0]
                    If [ToDos::flag To Do Completed  ≠ ""]
                        Set Field [ToDos::flag To Do Completed; ""]
                        Commit Records/Requests [No dialog]
                    End If
                End If
            Else
                #
                # FM -> Reminder
                #
                # overwrite all values
                Set Variable [$r; Value:MBS("Calendar.Item.SetTitle"; $c; ToDos::To Do Headline)]
                Set Variable [$r; Value:MBS("Calendar.Item.SetNotes"; $c; ToDos::To Do Main Text)]
                Set Variable [$r; Value:MBS("Calendar.Item.SetDueDate"; $c; ToDos::To Do Deadline )]
                If [ToDos::flag To Do Completed = "X"]
                    Set Variable [$r; Value:MBS("Calendar.Item.SetCompleted"; $c; 1)]
                End If
                If [ToDos::flag To Do Completed = ""]
                    Set Variable [$r; Value:MBS("Calendar.Item.SetCompleted"; $c; 0)]
                End If
                If [ToDos::To Do Priority="1 Jetzt"]
                    Set Variable [$r; Value:MBS("Calendar.Item.SetPriority"; $c;1 )]
                End If
                If [ToDos::To Do Priority="2 Sofort"]
                    Set Variable [$r; Value:MBS("Calendar.Item.SetPriority"; $c;5 )]
                End If
                If [ToDos::To Do Priority="4 Hat Zeit"]
                    Set Variable [$r; Value:MBS("Calendar.Item.SetPriority"; $c;9 )]
                End If
                Set Variable [$r; Value:MBS("Calendar.SaveReminder"; $c )]
            End If
        End If
    End If
    If [ToDos::SyncUID  = ""]
        # Create new reminder
        #
        # Which calendar? (Reminder List)
        Set Variable [$CalendarName; Value:""]
        If [ToDos::To Do By="PF"]
            Set Variable [$CalendarName; Value:"ToDo PF"]
        Else If [ToDos::To Do By = "GK"]
            Set Variable [$CalendarName; Value:"ToDo GK"]
        End If
        If [$CalendarName  ≠ ""]
            Set Variable [$c; Value:MBS("Calendar.NewReminder")]
            Set Variable [$r; Value:MBS("Calendar.Item.SetTitle"; $c; ToDos::To Do Headline)]
            Set Variable [$r; Value:MBS("Calendar.Item.SetNotes"; $c; ToDos::To Do Main Text)]
            Set Variable [$r; Value:MBS("Calendar.Item.SetCalendar"; $c;$CalendarName)]
            Set Variable [$r; Value:MBS("Calendar.Item.SetDueDate"; $c; ToDos::To Do Deadline )]
            If [ToDos::To Do Priority="1 Jetzt"]
                Set Variable [$r; Value:MBS("Calendar.Item.SetPriority"; $c;1 )]
            End If
            If [ToDos::To Do Priority="2 Sofort"]
                Set Variable [$r; Value:MBS("Calendar.Item.SetPriority"; $c;5 )]
            End If
            If [ToDos::To Do Priority="4 Hat Zeit"]
                Set Variable [$r; Value:MBS("Calendar.Item.SetPriority"; $c;9 )]
            End If
            If [ToDos::flag To Do Completed = "X"]
                Set Variable [$r; Value:MBS("Calendar.Item.SetCompleted"; $c; 1)]
            End If
            If [ToDos::flag To Do Completed = ""]
                Set Variable [$r; Value:MBS("Calendar.Item.SetCompleted"; $c; 0)]
            End If
            Set Variable [$r; Value:MBS("Calendar.SaveReminder"; $c )]
            #store id for update later
            Set Field [ToDos::SyncUID; MBS("Calendar.Item.GetUID"; $c)]
            Commit Records/Requests [No dialog]
        End If
    End If
    Go to Record/Request/Page [Next; Exit after last]
End Loop

See also

Example Databases

Blog Entries

This function checks for a license.

Created 18th August 2014, last changed 10th October 2023


Calendar.SaveEvent - Calendar.SelectEvent