Skip to main content

Notifications

Power Apps - Building Power Apps
Suggested answer

Creating an appointment using a powerapp

Like (0) ShareShare
ReportReport
Posted on 18 Dec 2024 13:19:32 by 206
Hello,
I have a powerapp that creates a reminder for our admin team to carry out a process when a driver leaves our fleet.  At the moment it works as it should, the user presses a button within the powerapp and amongst other things it books a reminder into the users Outlook for 7 days time.  Our process has changed slightly and I need to update the powerapp to reflect this change though i have no idea how to do this.

If a driver leaves at any point in any month there needs to be a reminder set into the users Outlook calendar for the 8th of the following month - any ideas how I will do this ?.  Below is the part of the code that works at the minute and i'm hoping someone can tell me how to edit it to perform the new appointment settings.

Thanks for your help in advance.
 
//Book reminder in for driver deletion
 
Office365Outlook.V3CalendarPostItem(LookUp(Office365Outlook.CalendarGetTables().value, DisplayName="Calendar").Name,"DELETE DRIVER FROM THE SYSTEM",  
 
DateAdd(Now(), 7 + TimeZoneOffset(),TimeUnit.Days),
 
DateAdd(Now(),7 + TimeZoneOffset(),TimeUnit.Days),
 
   { Importance:"High",
    IsAllDay: false,
    RequiredAttendees:"nichole.bates@stationtaxis.com; michael.grogan@stationtaxis.com",
    Body:"Reminder to delete this driver from the system 7 days after leaving "& Upper(FstName.Text) & " , " & Upper('2ndName'.Text) & " , " & "Badge Number:" & Badge2.Text & " " & BadgeDrvr.Text,
    IsHtml:true});
  • Suggested answer
    abc 123 Profile Picture
    abc 123 655 on 18 Dec 2024 at 14:47:38
    Creating an appointment using a powerapp
    The hardest part is figuring out when the next 8th is. It could look something like this:
    UpdateContext({dtmToday: Today()});
    UpdateContext({intMonth: Month(dtmToday)});
    UpdateContext({intYearNext: Year(dtmToday)});
     
    If(Day(dtmToday)<=8,
        //Use current month & year
        UpdateContext({intMonthNext: intMonth});
        UpdateContext({intYearNext: Year(dtmToday)});
        ,
        //Need to determine the next 8th.
       
        //Based on current Month, set next month and year
        If(intMonth < 12,
            UpdateContext({intMonthNext: intMonth + 1});
            ,
            UpdateContext({intMonthNext: 1}),
            UpdateContext({intYearNext: intYearNext+1})
        );
     
    );
     
    UpdateContext({dtmNextEight: intYearNext & "-" & intMonthNext & "-08"})
     
    Then, you can graft that into the same structure that you used previously to Post an appointment:
     
    Office365Outlook.V3CalendarPostItem(LookUp(Office365Outlook.CalendarGetTables().value, DisplayName="Calendar").Name,"DO SOMETHING ON THE 8th",  
    dtmNextEighth,
    dtmNextEighth, 
       { Importance:"High",
        IsAllDay: false,
        RequiredAttendees:"nichole.bates@stationtaxis.com; michael.grogan@stationtaxis.com",
        Body:"Reminder to do something on the 8th "& Upper(FstName.Text) & " , " & Upper('2ndName'.Text) & " , " & "Badge Number:" & Badge2.Text & " " & BadgeDrvr.Text,
        IsHtml:true});
  • Suggested answer
    Jiis Profile Picture
    Jiis 245 on 18 Dec 2024 at 14:38:48
    Creating an appointment using a powerapp
    Okay if it needs to be the next month 8. date
    Set(NextMonthFirstDay, DateAdd(Today(), 1, TimeUnit.Months) - Day(Today()) + 1);
    
    Set(ReminderDate, DateAdd(NextMonthFirstDay, 7, TimeUnit.Days));
    
    Office365Outlook.V3CalendarPostItem(
        LookUp(Office365Outlook.CalendarGetTables().value, DisplayName="Calendar").Name,
        "DELETE DRIVER FROM THE SYSTEM",  
        ReminderDate,
        ReminderDate,
        {
            Importance: "High",
            IsAllDay: false,
            RequiredAttendees: "nichole.bates@stationtaxis.com; michael.grogan@stationtaxis.com",
            Body: "Reminder to delete this driver from the system on the 8th of the following month: " & Upper(FstName.Text) & " , " & Upper('2ndName'.Text) & " , Badge Number:" & Badge2.Text & " " & BadgeDrvr.Text,
            IsHtml: true
        }
    );
    
    if it needs to be the next 8.date.
     
    Set(CurrentDate, Today());
    
    Set(CurrentMonth8th, DateValue(Text(Year(CurrentDate)) & "-" & Text(Month(CurrentDate), "00") & "-08"));
    
    If(
        CurrentDate <= CurrentMonth8th, 
        Set(ReminderDate, CurrentMonth8th), 
        Set(ReminderDate, DateAdd(CurrentMonth8th, 1, TimeUnit.Months)) 
    );
    
    Office365Outlook.V3CalendarPostItem(
        LookUp(Office365Outlook.CalendarGetTables().value, DisplayName="Calendar").Name,
        "DELETE DRIVER FROM THE SYSTEM",  
        ReminderDate,
        ReminderDate,
        {
            Importance: "High",
            IsAllDay: false,
            RequiredAttendees: "nichole.bates@stationtaxis.com; michael.grogan@stationtaxis.com",
            Body: "Reminder to delete this driver from the system on the 8th: " & Upper(FstName.Text) & " , " & Upper('2ndName'.Text) & " , Badge Number:" & Badge2.Text & " " & BadgeDrvr.Text,
            IsHtml: true
        }
    );
     
  • Jiis Profile Picture
    Jiis 245 on 18 Dec 2024 at 14:24:11
    Creating an appointment using a powerapp
    Do you need the reminder to be 8. date in the next month or does it need to be the next 8. date no matter if its this month or the next?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #9 Get Recognized…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,867

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 64,161

Leaderboard
Loading started