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
Solved! Go to Solution.
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,
....
....
}
)
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,
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."
Thank you!
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,
....
....
}
)
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,
@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."
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!
User | Count |
---|---|
258 | |
110 | |
97 | |
52 | |
39 |