Intro to conditional formatting & rules/validation when customizing SharePoint new item forms with PowerApps in Office 365

2018-01-13_17-23-37.gif
This post will introduce you to some basic conditional formatting, rules & validation ideas you can implement today in your customized SharePoint forms using PowerApps. And don’t worry – if you start making changes to your form and don’t want to keep them, you can easily switch back to the original SharePoint form.

Basics

Always know the name of what you’re referring to. Click on any part of your form to see the name of that specific component/control in multiple places as illustrated below.

datacard2

See below for the anatomy of a field being customized in PowerApps. Generally each card holds a field (name/key) and you enter (and likely make your rules/conditions on) values.

datacard

You’ll use these names in formulas.

rules

When referring to a text or number field, you can generally just use the value name (DataCardValue1>=100) but a choice field, date field, or anything requiring selection would be referred to something like DataCardValue1.Selection.Value1=”Professional Development”. This article on docs.microsoft.com is a great place to learn some basics with formulas, and I’ve included some specific ideas below that I’ll demonstrate further down in my example form:

Formatting/Basics

Text(DataCardValue…) -OR- DataCardValue.Text Format number as text
Value(DataCardValue…) -OR- DataCardValue.Value Format text as number
&& Insert multiple conditions in a rule (This && That)
Visible=false -OR- Visible=true Hide (or show) a field (such as if a certain choice field selection is made, hide an unrelated field)
DataCardValue1.Selected.Value1=”Choice Name” Using choice field selection in formula

Math

Sum(DataCardValue1, DataCardValue2) Sum/Addition
DateDiff(DataCardValue1.SelectedDate,DataCardValue2.SelectedDate) Get difference between two dates in “days.” DateDiff(Start,End)

Conditional Formatting & Dynamic Calculations

Concatenate(“Trip duration: “,Text(Sum(DateDiff(DataCardValue2.SelectedDate,DataCardValue3.SelectedDate),1)),” days”) Show length of trip once dates are entered (Trip duration: # days)
Concatenate(“Total: $”,Text(Sum(DataCardValue6,DataCardValue5,DataCardValue4))) “Live” totaling (Total: $####)
DataCardValue3>1/1/1899 && DataCardValue3<DataCardValue2 Condition for highlighting end date if less than start date. Waits until dates have both been entered before applying warning formatting.

Rules

DataCardValue3>1/1/1899 && DataCardValue2>1/1/1899 Hides “trip duration” until both dates entered
DataCardValue7.Selected.Value1=”Miller Award” && Value(DataCardValue6.Text)>50 If certain choice selected, warns value can’t be more than 50 for certain field
Sum(DataCardValue4,DataCardValue5,DataCardValue6)>1000 && DataCardValue7.Selected.Value1=”Professional Development” Warns if total exceeds certain amount based on choice field

See my video below to see each of these put into use for a travel request form.

To get started:

  1. Make sure your list is in modern view.
  2. Click PowerApps –> Customize forms OR Click “New” and “Customize”
    2018-01-14_14-22-21
  3. You may be asked to sign in.

3 Replies to “Intro to conditional formatting & rules/validation when customizing SharePoint new item forms with PowerApps in Office 365”

  1. Can you provide a clue on how to validate if a value in a fied isn’t unique across the list?

Leave a Reply to Bamboo Releases Office 365 Products for SharePoint; SharePoint Blog Power; Managed Cloud GrowingCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.