/PCF-Controls

Controls using PowerApps Components Framework

Primary LanguageTypeScriptGNU General Public License v3.0GPL-3.0

PCF-Controls

Controls using PowerApps Components Framework

NN Checkboxes

Custom Switch

Date as checkbox

Simple Notification

Action Button

NN Checkboxes

Download

Purpose

The purpose of this control is to allow user to associate/disassociate records for a many-to-many relationship displaying all possible records as checkboxes or toggle switches

Vidéo

Samples

Checkboxes Switches
No color / Not grouped Sample2 Sample1
Records Color / Not grouped Sample5 Sample6
No color / Grouped Sample3 Sample9
Records color / Grouped Sample4 Sample7
Group color / Grouped Sample10 Sample8

Configuration

This is the list of parameters that can be set on the control

Parameter Description Required Bound to an attribute
Display attribute Attribute to use as label for the checkbox X X
Relationship schema name Schema name of the relationship. required only if multiple many-to-many relationship exist for both related entities ?
Background color Attribute to use as background color X
Color Attribute to use as forecolor X
Columns Number of columns to display checkboxes X
Grouping Attribute Attribute used to group records. If used, this attribute must be the first attribute used to sort the view used by this control X
Layout Choose the layout for the rendering X
Switch Off color Default background color when the switch is Off. This parameter is overriden by the parameter Background color X
Switch On color Default background color when the switch is On. This parameter is overriden by the parameter Background color X
Allow to select a category Indicates if links must be added for each category to select/unselect all records X

Custom Switch

Download

Purpose

The purpose of this control is to allow user to add switch for Two Options attribute and apply the color and shape they want to fit with the color of the company.

Samples

Screenshot

Configuration

This is the list of parameters that can be set on the control

Parameter Description Required Bound to an attribute
Attribute The attribute to display as a switch X X
Off color Color used for the switch background when the value is Off
On color Color used for the switch background when the value is On
Switch color Color used for the switch
Layout Square or Round X
Display label Indicates if selected option label must be displayed next to the switch

Date as checkbox

Purpose

As mentioned by MVP Gus Gonzalez in this 2 minutes Tuesday video, Two Options attribute could be replaced with Datetime attribute for some business needs. This PCF allows to transform a date time attribute in custom switch to keep the behavior of a checkbox while storing value as the current date time.

Samples

Screenshot

Configuration

See documentation of Custom Switch. This is the same.

Simple Notification

Purpose

Allows to display a notification or an helpful message to the user in a section. This should avoid to create static web resource to display information.

Samples

Screenshot

Configuration

Parameter Description Required Bound to an attribute
Attribute The attribute to use to display the control X X
Notification type Type of notification X
Message Message to display X
Display a link? Indicates if an hypertext link must be added at the end of the message
Link text Text to be used for the link
Link Url to navigate to when clicking on the link

Action Button

Purpose

Allows to display a button to perform an action. To allow developer to do anything they want from the form, this button simply copies the text of the action button on the bound string attribute. The developer needs to add an onChange event to this string attribute, check for the value of the attribute (should be the text of the action button) and perform the action needed.

Samples

Screenshot

Sample script to be implemented to execute an action when the button is clicked

function onChange(context){
  let attribute = context.getEventSource();
  let value = attribute.getValue();
  if(value === "Run this!"){
    Xrm.Navigation.openAlertDialog({text: "Action button has been triggered!"});
  }
  // Clear the value and avoid to submit data
  attribute.setValue(null);
  attribute.setSubmitMode("never");
}

Configuration

Parameter Description Required Bound to an attribute Additional info
Attribute The attribute to use to display the control X X
ActionText Text of the action button X Can be a static string or a json object with language id like {"1033":"Run this!","1036":"Exécute ça!"}