I have a canvas app connected to SharePoint. What I am trying to do is, if gallery selected Display name is equal to person field selected display name AND Status selected value is equal to gallery selected status value, users should not be able to create an item. With below formula, if there is an "Out of County' status by any user, users are not able to create an item. How can I fix this?
- If a user has an 'Out of County' status - show the error message and disable submit button
-
OnSelect Property of Status
If(EditForm1.Mode = FormMode.New, If(Self.Selected.Value = "Out of County" And BrowseGallery1.Selected.Status.Value = "Out of County", Notify("You are already on deployment for an incident. Please edit your entry if you need to make changes",NotificationType.Error); Set(var1,1), If(StatusValue.Selected.Value = "In County", Notify("If you are returning back in County from an incident, please edit your exisiting OOC status.", NotificationType.Error); Set(var1,1), Set(var1,0)), Set(var1,0))); If(Self.Selected.Value = "In County", Reset(DataCardValue7))
Items Property of Personnel (Person field-DataCardValue7)
Office365Users.MyProfile()
DisplayMode of Submit Button
If(DataCardValue3.Selected.DisplayName = BrowseGallery1.Selected.Personnel.DisplayName && BrowseGallery1.Selected.Status.Value = "Out of County" && StatusValue.Selected.Value="Out of County", DisplayMode.Disabled, DisplayMode.Edit)
I tried this to check if an item with the same status and user already exists in the data source but it didnt work
If(
EditForm1.Mode = FormMode.New,
If(
Self.Selected.Value = "Out of County" &&
BrowseGallery1.Selected.Status.Value = "Out of County" &&
CountRows(
Filter(
DataSource,
StatusValue.Selected.Value = "Out of County" &&
CreatedBy.Email = User().Email
)
) > 0,
Notify("You are already on deployment for an incident. Please edit your entry if you need to make changes", NotificationType.Error);
Set(var1, 1),
If(
StatusValue.Selected.Value = "In County",
Notify("If you are returning back in County from an incident, please edit your existing OOC status.", NotificationType.Error);
Set(var1, 1),
Set(var1, 0)
)
),
Set(var1, 0)
);
If(Self.Selected.Value = "In County", Reset(DataCardValue12))