I have an app which updates a Sharepoint List from a user's input on a form. Users submit their updates using a button which patches. I want that, based off a toggle, right after the patch occurs the necessary owners of the updated row of data are automatically emailed. My below code somehow worked one day but the next it stopped working with the error message saying that the 'To' parameter is invalid. I have a text label setup to test the concat statement and it is correct and I also have played around with the order of execution. Not sure how to fix this.
Below is the button.
Patch(
'Audit Listings', TemplateGalleryList1.Selected, {Current: false} );
Patch(
'Audit Listings',Defaults('Audit Listings'),{
Index: Index_DataCard1.Update,
Title: Title_DataCard1.Update,
Risk: Risk_DataCard2.Update,
Rating:{
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Value:DataCardValue34.Selected.Value,ID:DataCardValue34.Selected
},
'Recommendation Ref #': 'Recommendation Ref #_DataCard4'.Update,
Recommendation: Recommendation_DataCard4.Update,
'PSC Management Response': 'PSC Management Response_DataCard6'.Update,
'Responsible Officer': 'Responsible Officer_DataCard4'.Update,
'Original Completion Date': 'Original Completion Date_DataCard2'.Update,
'Revised Completion Date': 'Revised Completion Date_DataCard1'.Update,
Status:{
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Value:DataCardValue31.Selected.Value,ID:DataCardValue31.Selected
},
'Update/Comments': 'Update/Comments_DataCard4'.Update,
Owner:
DataCardValue9.SelectedItems
});
If(Toggle1.Value = true,
Office365Outlook.SendEmailV2(Concat(DataCardValue9.SelectedItems,Email , ";"),
Concatenate("New notification test " & DataCardValue26.Text),
"Here is the message body.",
{ Importance: "Normal" }
),
Notify("Email notification is turned off.")
);
If( // check for errors
!IsEmpty(
Errors('Audit Listings'
)
), // if true, show any error messages
Notify(
Concat(
Errors(
'Audit Listings'
), Column & ": " & Message
), NotificationType.Error
),
Notify(
"Your submission was accepted", NotificationType.Success
)
);
Navigate(AuditList);