I have a bunch of code that repeats and need some help simplifying it because it has become quite long and difficult to manage. I will do my best to explain it. Below is the interface
In a typical architectural engineering project there are 3 submittals(Where content is sent to the owner), a 100% DD, 60% CD, and a 90% CD. I have some code that creates 3 calendar invites per submittal. One on the date of the submittal, another 3 days prior for a QC check, and a Clash Report 5 days prior. I have code for each of the calendar invites. When added up there are 9 calendar invites sent out and that means 9 blocks of code with various variables swapped out. Below is the code for the submittal date, QC date, and Clash Report date.
Submittal Date:
Office365Outlook.V4CalendarPostItem(
//Users calendar, dont change
LookUp(Office365Outlook.CalendarGetTables().value, DisplayName = "Calendar").Name,
// Subject of the meeting, you can change
txtFirstDeliverable.Text & " | " & txtProjectNumber.Text & " - " & txtProjectName.Text,
// The time the meeting starts converted to UTC time. Replace Now with the date time you want the meeting
DateAdd(DateTimeValue(dat100DD.SelectedDate + Time(10,00,00)), 0, TimeUnit.Minutes),
DateAdd(DateTimeValue(dat100DD.SelectedDate + Time(10,00,00)), 30, TimeUnit.Minutes),
"Central Standard Time",
//OPTIONAL
{
requiredAttendees:emailAdresses.Text,
body: "This is an autogenerated calendar invite for the project " & txtProjectNumber.Text & " - " & txtProjectName.Text & ". This invite is to remind you that the QC set for 100% DDs are due today " & "(" & dat100DD.SelectedDate & ")."
}
);
QC Date:
Office365Outlook.V4CalendarPostItem(
//Users calendar, dont change
LookUp(Office365Outlook.CalendarGetTables().value, DisplayName = "Calendar").Name,
// Subject of the meeting, you can change
txtFirstDeliverable.Text & " QC | " & txtProjectNumber.Text & " - " & txtProjectName.Text,
// The time the meeting starts converted to UTC time. Replace Now with the date time you want the meeting
DateAdd(DateTimeValue(var100DD_QC_Date + Time(10,00,00)), 0, TimeUnit.Minutes),
DateAdd(DateTimeValue(var100DD_QC_Date + Time(10,00,00)), 30, TimeUnit.Minutes),
"Central Standard Time",
//OPTIONAL
{
requiredAttendees:emailAdresses.Text,
body: "This is an autogenerated calendar invite for the project " & txtProjectNumber.Text & " - " & txtProjectName.Text & ". This invite is to remind you that the QC set for " & txtFirstDeliverable.Text & " are due today " & "(" & var100DD_QC_Date & ")."
}
);
Clash Report date:
Office365Outlook.V4CalendarPostItem(
//Users calendar, dont change
LookUp(Office365Outlook.CalendarGetTables().value, DisplayName = "Calendar").Name,
// Subject of the meeting, you can change
txtFirstDeliverable.Text & " CLASH REPORT | " & txtProjectNumber.Text & " - " & txtProjectName.Text,
// The time the meeting starts converted to UTC time. Replace Now with the date time you want the meeting
DateAdd(DateTimeValue(var100DD_CR_Date + Time(10,00,00)), 0, TimeUnit.Minutes),
DateAdd(DateTimeValue(var100DD_CR_Date + Time(10,00,00)), 30, TimeUnit.Minutes),
"Central Standard Time",
//OPTIONAL
{
requiredAttendees:emailAdresses.Text,
body: "This is an autogenerated calendar invite for the project " & txtProjectNumber.Text & " - " & txtProjectName.Text & ". This invite is to remind you that the CLASH Report for " & txtFirstDeliverable.Text & " is due today " & "(" & var100DD_CR_Date & ")."
}
));

Report
All responses (
Answers (