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
Super User

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
Super User

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
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (9,703)