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 / PowerApp to obtain a v...
Power Apps
Answered

PowerApp to obtain a value from a list

(0) ShareShare
ReportReport
Posted on by 8

Hi All,

 

Very new to PowerApps and have made this my first project to attempt but just want to hear that something like this is possible. I'm familiar with SharePoint and Office 365 as a platform and I've been asked to move our employee discount code generator from a .net internal form on our old intranet to PowerApps.  

 

It's actually a lot more simple than an actual generator.  I just need to use list of available codes in a list or sql table that we manage and provide one to a user that presses a "Get Code" button in a PowerApp.  Also need to capture the user requesting the code and fill that info in some additional columns in the table or SharePoint list next to the code that was provided.

 

Before diving head first into it, hoping someone can tell me if it's possible.  I've searched quite a bit and haven't found any examples of this specific use case although, I'm pretty sure that it is possible.

 

Thanks in advance!

PowerAppNewb

 

 

Categories:
I have the same question (0)
  • mdevaney Profile Picture
    29,991 Moderator on at

    @PowerAppNewb 

    Yes, it’s definitely possible.

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • PowerAppNewb Profile Picture
    8 on at

    Thank you! 

  • Verified answer
    v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @PowerAppNewb ,

    Regarding the needs that you mentioned, I think PowerApps canvas app could achieve your needs.

     

    Firstly, you could generate a canvas app based on your SP List or create a canvas app from scratch. Then within the app screen, add a button control, called "Get Code", set the OnSelect property of the "Get Code" button to following:

    Set(
     CodeValue,
     LookUp('Your SP List', FilteredColumn = "xxx").CodeColumn
    )

    The above formula would find the Code value from your SP List based on a specific filter condition, then save it into a variable. You reference the acquired Code value through the CodeValue variable directly.

     

    If you want to choose a Code value from your SP List randomly, I think the Shuffle function could achieve your needs:

    Set(
     CodeValue,
     First(Shuffle('Your SP List')).CodeColumn
    )

    above formula would choose a Code value from your SP list randomly, then save it into a variable.

     

    In addition, if you want to fill some additional columns next to the code value the user is requesting in your SP List, please try the following formula:

    Patch(
     'Your SP List',
     LookUp('Your SP List', CodeColumn = CodeValue),
     {
     AdditonColumn1: User().FullName,
     AdditionColumn2: User().Email,
     ....
     ....
     }
    )

    Patch function

    LookUp function

     

    If you want these Codes which have already been requested not to be requested again, please consider modify above Shuffle formula as below:

    Set(
     CodeValue,
     First(
     Shuffle(
     // Filter out these record which has been requested already
     Filter('Your SP List', IsBlank(AdditionColumn1) && IsBlank(AdditionColumn2) ...)
     )
     ).CodeColumn
    )

     

    Please try above solution, check if it could help in your scenario.

     

    Regards,

  • mdevaney Profile Picture
    29,991 Moderator on at

    @PowerAppNewb 
    The best course of action here is to begin building the app for yourself.  Then for each issue you have when building it post a new question  on the forums.  It is easier to respond to a small question rather than a large one.

     

    Please close this thread if I answered your current question 🙂

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • PowerAppNewb Profile Picture
    8 on at

    @v-xida-msft 

    I've given this a shot and think I have my button set up correctly but when I add the variable name to the label, it throws an error.

     

     

    Set(
     EmployeeDiscountCode,
     First(
     Shuffle(
     // Filter out these record which has been requested already
     Filter('Employee Discount Codes', IsBlank('Requested By')
     )
     ).Code
    )

     

     

    For the label formula I'm just adding EmployeeDiscountCode but it doesn't seem to be picking it up as a variable.  Also, if I wanted to include the patch statement to add the user requesting it, would you add that to the same formula for the get code button?


    Thanks for all your help!

     

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!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 519 Most Valuable Professional

#2
11manish Profile Picture

11manish 489

#3
Haque Profile Picture

Haque 327

Last 30 days Overall leaderboard