cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ThePowerAppsGuy
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
Drrickryp
Super User II
Super User II

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

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

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
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Top Kudoed Authors
Users online (45,592)