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 / How to make a validati...
Power Apps
Unanswered

How to make a validation using the existing records on sharepoint list

(0) ShareShare
ReportReport
Posted on by 943

Hi all,

 

I need to check if a record is already exist in my SP list table, so then the user can create the exact same name in the SP list.

 

The idea is users only can create a new candidate which that candidate name is already on the SP List.

 

I know that need checking and all a.ka validation.. but,

Is this idea possible to achieve by only using powerapps capabilities?

BR,

pytbyt

Categories:
I have the same question (0)
  • SkiDK Profile Picture
    1,016 on at

    I'm not sure what you mean, you want to check if a certain user already exists in a table to be able to add it in another table? 

     

    In the next lines you search for name of the user 'vNameUser' in the table column 'nameUser', and if it's empty it will store the 'vNameUser' in another datasource.

    If (
     IsEmpty( LookUp (SP_Datasource1, nameUser = vNameUser)),
     Patch ( SP_Datasource2,
     Defaults( SP_Datasource2),
     {
     nameUser = vNameUser
     }
     )
    )

    This might not be exactly what you need, but it shows it can be done in Powerapps.

     

    I hope this helps. Let me know if it's something else that you mean, and I'll try to look into it.

  • PytByt Profile Picture
    943 on at

    @SkiDK wrote:

    I'm not sure what you mean, you want to check if a certain user already exists in a table to be able to add it in another table? 

     


    Hi @SkiDK 

     

    thank you for your reply. 

     

    what i meant is, 

    - if a user want to create new candidate name, the app is checking it first in the sharepoint list wether the new candidate name is already there or not.

    - if the new candidate name is NOT in the sharepoint list (the one that user just create) then, the app refuse to continue.

    - that being said, the user can only create ne candidate name that already there in the sharepoint list. Or we can just say that the user is only can add the same candidate name that already on the sharepoint list.

     

    i hope the above explaination is clear enough.

     

    BR,

    pytbyt

  • SkiDK Profile Picture
    1,016 on at

    Hey @PytByt 

     

    I'm a little confused by creating a name into a list that already exists. Where do you check for the name, and where do you store the name? Is it the same list? How is the candidate name linked to the user?

     

    I don't really understand the structure of your data, so that I can think about a way of working with it.

     

     

  • PytByt Profile Picture
    943 on at

    @SkiDK 

     

    im a bit confused also, but this is my user bussines demand.

     

    in short,

    they just want to be able create new record with the same name (candidate name) that already exist in the candidate name column in the sharepoint list, so they also be able to add the different site name (with the same name)

    (yes, i have candidate name column and site name column in the sharepoint list)

     

    the validation needed, so they cant created new record with the different name with the same site name also.

     

    i hope that sum it up, let me know if you need anything from my side.

     

    cheers,

    pytbyt

     

     

  • SkiDK Profile Picture
    1,016 on at

    Hi @PytByt,

     

    Okay thanks. I think I've got it now.

     

    It's not far from the code I had before:

     

    If (
     Not(IsEmpty( LookUp (SP_List, candidate_name = vNameUser))),
     Patch ( SP_List,
     Defaults( SP_List),
     {
     candidate_name: vNameUser
     site_name: vSiteName
     }
     ),
     //Add functionality to refuse the continuation
    )

    'vNameUser' is the variable of the name (could be a textbox or any other type of value as well), same for 'vSiteName' which is the value for the site name.

     

     

    You'll check first if the candidate name already exists in the table column candidate_name with a lookup, by looking for a name that matches the value of the new candidate name. It will get the first value that matches the condition, and if it does not match the lookup will remain empty. Using the IsEmpty() function we can then check if the lookup is empty or not, returning 'true' when empty and 'false' when a value matched the condition.

        I put another Not() around it so the values switch, and true means there is a match and false means there is no match, because then the first line in the 'if' statement is the main functionality where we patch the new record to the SP list. (Or change the patch with other code that needs to be done before creating a new record.) The next line is to add functionality to refuse continuation or you can just leave it out if you want nothing to happen.

     

    I hope this helps, let me know if it's not clear or I'm still wrong about the point haha.

  • PytByt Profile Picture
    943 on at


    @SkiDK 

     

    hahaha.. that is wonderful, i will try it ASAP.

     

    i just need some more explaination which is where should i put the variable vNameUser and vSiteName ?

    i ask this because i just migrating to powerapps due my company needs, and i still learn about it.

     

    cheers,

    pytbyt

     

     

  • SkiDK Profile Picture
    1,016 on at

    Hey @PytByt 

     

    I inserted those variables just to show where to place the values. You can do it with those variables, which you'll first need to set up somewhere by doing the following:

     

     

    Set( vNameUser, "Name of the user to check on")
    Set(vSiteName, "site name to put in new record")

     

    You can initialize these in the OnVisible property of a screen, or on an action of elements like the OnSelect of a button. If you have a form with TextBoxes and a button to check and submit, you could put the next on the OnSelect property of that button:

    Button: OnSelect =
    Set( vNameUser, TextBoxCandidateName.Text)
    Set(vSiteName, TextBoxSiteName.Text)

     

    Or if you're only using texboxes with the values in it, you could use 'textBox.Text' instead, like this:

     

    If (
     Not(IsEmpty( LookUp (SP_List, candidate_name = vNameUser))),
     Patch ( SP_List,
     Defaults( SP_List),
     {
     candidate_name: textBoxCandidateNaeme.Text
     site_name: textBoxSiteName.Text
     }
     ),
     //Add functionality to refuse the continuation
    )

     

    Depends on how you check and where you get the values from. Let me know if something does not work.

  • PytByt Profile Picture
    943 on at

    @SkiDK 

     

    Thank you very much on this. really.

    but, i will need to try it later on since i got so many on my plate right now.

     

    anw,


     

    Depends on how you check and where you get the values from. Let me know if something does not work.


    i get it from form DataCardValueCandidateName

     

     

    btw, are you ok with a rain check?

     

    cheers,

    pytbyt

  • SkiDK Profile Picture
    1,016 on at

    @PytByt 

     

    No problem, I hope it helps.

     

    Then your value will be DataCardValueCandidateName.Text.

     

    Yes, sure. Let me know.

     

    Good luck

     

  • PytByt Profile Picture
    943 on at

    @SkiDK wrote:

    Hey @PytByt 

     

    I inserted those variables just to show where to place the values. You can do it with those variables, which you'll first need to set up somewhere by doing the following:

     

    Set( vNameUser, "Name of the user to check on")
    Set(vSiteName, "site name to put in new record")

     Hello @SkiDK 

    I wonder what is exactly should i put to replace the red text that i underlined on?

    And im gonna put them in my screen OnVisible property.

     

    Also, 

    What should i put in this part?

     


    If (
     Not(IsEmpty( LookUp (SP_List, candidate_name = vNameUser))),
     Patch ( SP_List,
     Defaults( SP_List),
     {
     candidate_name: textBoxCandidateNaeme.Text
     site_name: textBoxSiteName.Text
     }
     ),
      //Add functionality to refuse the continuation
    )

     

    Sorry for troubling you mate.

     

    Cheers,

    pytbyt

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 551

#2
WarrenBelz Profile Picture

WarrenBelz 430 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 298

Last 30 days Overall leaderboard