BPC-Components

Home > Products > BPC PowerForms > Knowledge Base > API Reference > The PeoplePicker control

The PeoplePicker control

The PeoplePicker control is used to load  users and groups from two different sources. It can access data from sharepoint or from Active Directory.

The users and groups are not loaded during form startup so this control is the most suitable to display large amount of users and groups.

It allows users to search for  the required value using a popup search form, activated by the "Browse" button.


The value of the control is in the following format (when accessed from script using the GetValue() method) :

Code

// Bound to lookup entity

ID1;#USERNAME1

Designer Properties

Type : PeoplePicker

Name

Provides a unique name for the control.

Binding

Indicates if the control is

  • Unbound
  • Bound to list column
  • Is a label for a control bound to list column

Enabled for new records

Sets if the control will be enabled or disabled when the forms handles a new record

Enabled for existing records

Sets if the control will be enabled or disabled when the forms handles an existing record

Required

Marks the cotnrol as Required.

By default, the system recognizes required fields and marks them with this flag. Additionaly, controls can be marked as required event if the bound column is not.

Enabled Formula

Set an expression then will be evaluated during run-time and enable or disable the control.

The expression must be in javascript and should return a boolean value.

Dependencies between controls are automatically identified and the expression is re-calculated every time a control affecting the formula changes.

Example :

Code

form.GetControl("c_Status").GetValue() != "Open" && form.UserInGroup("Administrators")

Visibility Formula

Define a valid formula (using javascript) that will be evaluated during runtime to show or hide the control.

The expression should return a boolean value.

For example :

Code

form.FieldValue("c_Status") != "Rejected" || form.UserID() == "1"

Value

This property defines how the control will get its value.

 

Here are the available options :

  1. The value is Static (this is the default for label controls)
  2. The value will be provided by the user (Not applicable for labels)
  3. The value will be calculated by a formula
  4. The value will be retrieved from a list query
  5. The value will be provided by a web service call
  6. The value will be provided by a SQL query
Static value

A static text must be set in the appropriate designer control.

Formula

A javascript expression must be set that will provide the value for the control.

If the formula contains references to other controls, dependencies will be automatically identifies during run-time and the value will be updated to reflect changes.

Example :

Code

form.FieldValue("c_Active") ? "Yes" : "No"

There is an additional option that instructs the form to perform calculations only for new records. Existing records will keep their original value.

List Query

A predefined list query is bound to the value of the control. So during form initialization, the specified list query is executed and if it returns any item, it selects the first one and it will apply the value to the label based on the following rule :

If a Field Name has been selected in the corresponding box, that specific column will be used from the list item to fill the control value.

If the Field Name is left blank, the first column retrieved will be used.

Web Service

The same as above, the required web service is selected and after the web service retrieves data, the first item will be used to update the control value. If no Field Name is set, the control will receive the first field of the  retrieved item.

SQL Query

Works the same way ListQueries and Web Service works.

Default Value

The default value has any effect only of the control is bound to a list column.

For unbound controls, the default value is ignored.

You may set a static value here or use a formula by starting your input with the "equals" (=) sign.

Code

1;#Administrator

Layout Properties

Width

Not applicable  

 

Height

Not applicable  

 

H.Align

Not applicable  

 

V.Align

Not applicable  

 

 

Fore Color

Not applicable   

 

 

Back color

Not applicable   

 

Cell Color

Defines the color of the parent cell.

Font Size

Declares the font size of the text

Margin

Sets the margin applied to the control, that is, the spacing between the control and the cell borders.

Font Bold

Changes the weight of the font used

Italics

Changes the font style for the control text

Lookup Details

This control belongs in  the People controls which have only one method enabled.

The method enabled is :

Users/Groups

This is the default method if the underlying column is a people column.

 

People only

The property indicates that only users (not Groups) will be included in the retrieved lookup records

Preload data

Cannot be set in People Combo box. In People Picker and MultiPeople Picker if this property is checked, the records will be loaded automatically when opening the search popup dialog.

Specific Group(s)

Users can select one or more SharePoint groups to restrict results loading users only from the specified groups. This options is available only when the "People Only" property is selected.

 

 

Extra Configuration

ActiveDirectorySearch

When this property is set to True, the control searches Active Directory users also the same way that SharePoint does in People Pickers and requires the user to provide a search filter. If set to False, it retrieves users and groups from SharePoint groups.

AllowFreeTextEntry

Allows the user to input a free-text user name/email into the people picker textbox. Useful in custom claims provider cases where out of the box user search and validation does not work.

Script

Sets the script that will be executed at the value-change event of the control.

Example :

Code

var value = form.GetControl("c_Title").GetValue();

if (value == "Open") form.HideSection("Details");

else form.ShowSection("Details");