Advent Calendar Door 14: Setting default and initial field values in SharePoint forms
Setting default and initial field values in SharePoint forms
In today’s skybow Advent Calendar, again one of the classics: prepopulating values in SharePoint forms, based on current data, user, and context. It is not possible in out-of-the box SharePoint list forms, but it is a very simple task both with skybow Solution Studio and skybow Rich Forms.
Let’s try to imagine just one of the possible scenarios: in a SharePoint list, there is a text field called “Location”. When a new form of that list is displayed, the “Office” property should be read from current user’s profile, and the field “Location” should be set to that value, locked for editing, so that the user cannot change it.
Those are the steps we are going to follow in order to make this work:
- Open the form where the field that should be initially set is located, and select the field
- Click the Expression Builder icon besides the “Initial” value in the “Behavior” tab
- Select the “Office” user profile property, under the “User” context object, and save the expression
- Set the “Enabled” expression on false, to make the field read only.