Power Apps Cheatsheet
Power Apps Cheatsheet
www.pragmaticworks.com
Problem Expression
Navigate to a Navigation can be done two ways: either go back to the previous screen you cam
new from or navigate to a specific screen.
screen Navigate(ScreenName)
Optionally, you can specify an effect during the
transition: Navigate(ScreenName, ScreenTransition.Fade)
Updating or The Patch function is one way to update or insert data without using a form. For
example, you can tie it to an OnChange even of a drop down box.
inserting data
without a form For inserting a record:
Patch(DataSource, Defaults(DataSource), {ColumnName:"Value1",
ColumnName2:Number2}) Similarly, you can update data when you select an item in
a gallery:
Patch(DataSource, ThisItem, {ColumnName:”Value1″, ColumnName2:Number2})
Get the first Some systems will require you insert the first day of the month vs
Day of today’s date.
www.pragmaticworks.com
Problem Expression
SharePoint Lookups and the Person Picker in Sharepoint require some variations to your code in
Variations Power Apps since it’s a packed field, meaning that the one field has a bunch of items
inside of it with references. This gives you the ability to navigate the hierarchy easier in
with a Power Apps.
aperson
For filtering based on a Person Picker based on the person who’s signed in:
apicker //Put this code in the App OnStart
a Set(varUserEmail, User().Email)
a //Gallery code or wherever you want to filter
a Filter('Assembly Work Orders', Owner.Email=varUserEmail)
a Patching is especially challenging into a Person Picker and a choice column. Both are shown
a below showing you how to unpack the column before inserting into your list. The below is
aa showing inserting with Patch into a SharePoint list with a choice column called Status and a
Person Picker column called Owner. A title column is required also for SharePoint.
a
Patch(‘SharePoint List Name’, Defaults(‘SharePoint List Name’), {Title:”Your record title here”,
a Status:
a {‘@odata.type’:”#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference”,
a Value:”Complete”}, Owner:{ ‘@odata.type’:
“#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser”, Department: “”, Claims:
a
“i:0#.f|membership|” & User().Email, DisplayName:
aa User().FullName, Email: User().Email, JobTitle: “”, Picture: “” } }) Filtering on a choice column
a requires that you specify the value of the choice as shown below with a drop-down filter.
a Filter('SharePoint List Name', ChoiceColumn.Value=Dropdown1.SelectedText.Value)
a Defaulting a drop-down box in a form to your name in a person picker column
a Set the DefaultSelectedItems property to the following if your form is called Form1 and your
a Person Picker column is called CreatedBy. Note the code is going to check to see if the form is
in New mode and do this or if it’s in edit mode, it will keep its existing value from the list.
a If(Form1.Mode = New,{
a '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
a Claims:Concatenate("i:0#.f|membership|",User().Email),
a DisplayName:User().FullName,
Email:User().Email
a },
a ThisItem.CreatedBy)
www.pragmaticworks.com