web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Prevent duplicate entr...
Power Apps
Unanswered

Prevent duplicate entry by the same user

(0) ShareShare
ReportReport
Posted on by 6

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))

 

 

Categories:
  • v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @Meazig ,

     

    Based on your description, it seems that var1 is the key to controlling the DisplayMode of the Submit Button. Maybe you could try:

     

    If(var1=1, DisplayMode.Disabled, DisplayMode.Edit)

     

    Best Regards,

    Bof

     

  • Meazig Profile Picture
    6 on at

    The submit button is behaving as expected. The problem is If there is any user in the gallery with an 'Out of County' status, other users are not able to create an item. I want to check if the logged in user has an 'Out of County" status, if yes show the error message and disable submit. But multiple users can have an 'Out of County' status at the same time. 

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 271

#3
Mohsin Ali Profile Picture

Mohsin Ali 239

Last 30 days Overall leaderboard