Canvas Apps – Auto populate Option Set value in the Canvas App Form

Introduction

Hi Everyone,

Hope you are well and staying safe!
In today’s #PowerGuideTip30, I will show you how to auto-populate or set value in Option set field in Canvas App.
I have designed a Canvas App for Event Management purposes, where I have added a screen that the Event Organizer uses to create an Event. This screen has an Option Set field called ‘Event Status’ that shows the status of the event.
I don’t want to allow the Event Organizer to set the Event Status value manually and want to auto-populate its value to ‘Submitted’ instead.



Solution

To auto-populate value in Option Set value or Set value in Option Set value you should use Choices() expression.
  • The Choices function returns a table of the possible values for a lookup column.
  • Use the Choices function to provide a list of choices for your user to select from. This function is commonly used with the Combo box/ Drop Down control in edit forms.
Syntax
Choices( column-reference )
column-reference – Required. A lookup column of a data source or Option Set Field column. Don’t enclose the column name in double-quotes. The reference must be direct to the column of the data source and not pass through a function or control.
Implementation
Choices(‘Event Status (Events)’.Submitted)
where ‘Event Status (Events)’ represents the Event Status column of the Event table in Microsoft Dataverse and Submitted is the Option set value that I want to auto-populate.

Note: I want to auto-populate the option set value, hence I have used the Choices(….) expression directly on the items property of Combo box. If you want to set the value on button click then you can use the same expression on onselect property of button control.
Useful Reference
I hope you found this PowerGuideTip helpful. 

Stay tuned for #PowerGuideTip31
- Advertisement -

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisement -

Latest News

- Advertisement -

More Articles Like This

- Advertisement -