cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Resolver II
Resolver II

How to set a default value in Options Set to CDS?

Hi everybody!

 

Just got a short question about setting a default value in an Options Set column in a CDS.

You know if you create a field in CDS, you can choose the Data type and I've chosen Option Set - yes and no (boolean) and set the default value to none in the field option.

 

But how to set a default value by adding a record into the CDS? I've tried ColumnName: Blank() - It's being accepted but it's not working the way I like. I'm afraid the default value is set to "Yes" or "No". But I need an empty value in the column.

 

How to achieve this?

 

Thanks so much for helping!

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

Re: How to set a default value in Options Set to CDS?

Hi @ThePowerAppsGuy 

If use a two value option set, I don't believe that you can do what you want.  However, if you use a regular option set, and set it to no default value and Required is set to optional, if the user doesn't make a choice in that field, it will be entered as a blank. In the edit form in the app, you can modify the Display name in the card for that field to 

 

Parent.DisplayName & " (Optional)"

 

So that the user knows that a choice is not required.  In the combobox in the card there is a property called no selection text.  You can put a message in there like "none".

Annotation 2020-06-07 100855.jpg

View solution in original post

2 REPLIES 2
Highlighted
Super User III
Super User III

Re: How to set a default value in Options Set to CDS?

Hi @ThePowerAppsGuy 

If use a two value option set, I don't believe that you can do what you want.  However, if you use a regular option set, and set it to no default value and Required is set to optional, if the user doesn't make a choice in that field, it will be entered as a blank. In the edit form in the app, you can modify the Display name in the card for that field to 

 

Parent.DisplayName & " (Optional)"

 

So that the user knows that a choice is not required.  In the combobox in the card there is a property called no selection text.  You can put a message in there like "none".

Annotation 2020-06-07 100855.jpg

View solution in original post

Highlighted
Resolver II
Resolver II

Re: How to set a default value in Options Set to CDS?

Hey @Drrickryp,

 

appreciate your support. Thanks so much.

 

However, if you use a regular option set, and set it to no default value and Required is set to optional, if the user doesn't make a choice in that field, it will be entered as a blank.

Yes, I've tried this as well. Before writing this post, all my code behaves differently and I thought this might not be the solution I'm able to choose.

 

After you've written your reply, I've tried it again and it worked.

 

Thanks so much for helping!

 





Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (5,901)