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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to display error m...
Power Apps
Unanswered

How to display error message if value already exist?

(0) ShareShare
ReportReport
Posted on by

Hello,

 

I have a CDS Entity having Primary Name Field called "Item ID" which is bound with Edit Form control.

 

I want to display an error message, if duplicate field is found already in the entity.

 

which formula I can use to identify whether value is unique or not?

 

Thanks,

Categories:
I have the same question (0)
  • eka24 Profile Picture
    20,923 on at

    Follow this Post;

    https://powerusers.microsoft.com/t5/Building-Power-Apps/Check-if-record-exist/td-p/377121

     

    If you have issues give a feedback of your code

    ------------

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

  • Filipe Relvas Profile Picture
    on at

    Hello Dave,

     

    Please correct me if I'm wrong but if I understood you correctly you want to display a message when you submit the form stating the Field in question is duplicated and prevent a record create / update from happening, correct?

     

    I believe you have two distinct options here:

     

    Server Side:

    Since these records will be kept in a CDS / Dynamics environment you can create an Alternate Key which will throw an error based on the Field of your choice if it detects a duplicate. The CDS connector while making the submission to the Datasource will then show a similar error to this one:
    FilipeRelvas_2-1600692513848.png

     

    Documentation:

    https://docs.microsoft.com/en-us/powerapps/maker/common-data-service/define-alternate-keys-portal

     

    Note:

    Please note that if you already have duplicates in the system, make sure you resolve them before creating the Alternate Key otherwise it won't work as the System Job that will create will fail.

     

     

    Client Side:

    You can also perform a check before submitting the form by performing a request against the Data Source and looking for any records with that same Field Value. You can use the Lookup() function to do so.

     

    Example: 

    LookUp(Accounts, 'Account Name' = DataCardValue.Text) --> This will return the first record that meets the condition. Which means that if a record is returned a duplicate exists and you should Notify the user and abort or prevent the form submission.

     

    Hope this helps 🙂

     

    Filipe Relvas.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard