Sunday 2 May 2021

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

2 comments:

  1. Welcome back!Hope, you have more power than yesterday :) Short but nice article. Thanks, Arpit

    ReplyDelete
  2. Special thanks to (hackingsetting50@gmail.com) for exposing my cheating husband. Right with me i got a lot of evidences and proofs that shows that my husband is a fuck boy and as well a cheater ranging from his text messages, call logs, whats-app messages, deleted messages and many more, All thanks to

    (hackingsetting50@gmail.com), if not for him i will never know what has been going on for a long time.

    Contact him now and thank me later.

    ReplyDelete

Blogger Widgets