Lightning Forms – Expressions – Calculating Field Values

this video, we explore the Expression Builder in Lightning Forms. The Expression Builder in Lightning Forms helps you to easily add validation rules, calculations, default values, Enabled and Visible condition's, Conditional Formatting and more. In this video, we explore how to access the Expression Builder on each of the controls in your SharePoint list form. In subsequent video's, we will explore some example expressions.

In this video, we build on the previous video, and focus on some specific examples of using expressions without code to apply values to fields.

Once you have opened the Expression Builder, you will see three tabs: Template, Assignment, and Function.

  • Template – Used for building concatenations without the complexity of using operators. e.g. Full name is [[FirstName]] [[LastName]] would evaluate to Full name is Brett Lonsdale
  • Assignment: Used for building calculations or expressions with operators that return a value. e.g. [[SalesTax]]+[[SubTotal]]
  • Function: Used for building expressions using JavaScript. e.g. var date = new Date();return date;


Placeholders can be double clicked or dragged into the expression window. The placeholders include:

  • Fields within your form
  • Contextual Values
  • Sublists


Fields can be double clicked in order to use the field as part of your expression. The fields can also be expanded to show ‘OriginalValue, IsChanged, or IsInvalid’. The latter two are useful when building validation rules against fields.

The outcome of your Expression can be tested against a list item using the Test button at the bottom of the Expression pane.


The Context placeholders enable you to retrieve properties from the context of your form. Your form is within a list, which is in a site, which is in a site collection. It is being accessed by the current user on the current page. Properties can be retrieved from each of these contextual properties:

  • Form – properties about the form that you are on such as ItemID and ListID. IsDisplayForm, IsEditForm, IsNewForm, and IsSubListForm are useful when applying conditions such as formatting or validation.
  • Page – The current page properties such as CultureName, GetQueryString, Language, UICultureName and URL.
  • Site – The Site Collection that you are in. GetFirstValueForQuery, and GetValuesForQuery enable you to retrieve values using CAML Queries. ServerRelativeURL and Url can bring back the URL of the current site collection.
  • User – Return information about the current user such as Title, Login Name, Location, and Email. Two functions can be used to test if a user is a member of a SharePoint group or Azure Active Directory Group. These include IsMemberofGroup and IsMeberofAADGroup.
  • Web – Returns information about the current Site. e.g. Title, URL, Language and GetValues Queries.
Expression Builder with Context Placeholders


Using the Expression Builder, you can access Sub lists to get at the columns within the sublist, and use a summary function against the related items. e.g. Sum, Min, Max, Count. The below example is returning a sub total from the Line Total column in the Sublist and returning it to the Sub Total column on the main form.

Leave a comment