Reply
Level: Powered On
Posts: 5
Registered: ‎12-27-2016
Accepted Solution

CDS Picklist Dropdown Allow Blanks and Show Blank if No Value

I have a form that shows the item selected in a gallery. One of the fields is a custom picklist dropdown (High, Moderate, Low). Currently, all the items in the CDS have no value for this field. However, when I load an item into the form it defaults to "High". I would prefer it show a blank and I would like a blank option in the dropdown. Is this possible or do I have to hack my way into making this work? 


Accepted Solutions
Level: Powered On
Posts: 5
Registered: ‎12-27-2016

Re: CDS Picklist Dropdown Allow Blanks and Show Blank if No Value

For any that are curious, my solution has been to create a new Entity called Lists. This entity consists of a description field and then a boolean field for each picklist I want to create. I have allowed blank values for the description field and my first entry in the entity is a blank description field with all boolean values set to true, so it will be in every dropdown.

 

For instance, in the standard Product entity I created a relationship to lists and named it Quality. Then, in my form I delete the lookup dropdown and input a custom dropdown with ProductForm.Items = Filter(Lists, HighModLow = true)


Here is the an excerpt of the Lists table I am referring to:

 

Primary ID 

Description

 HighModLow

000001

 

True 

000002 

high 

True 

000003 

moderate 

True 

000004 

low 

True 

 

I hate hacks, but it is better than not being able to accomplish what I need!

View solution in original post


All Replies
Community Support Team
Posts: 2,683
Registered: ‎06-22-2016

Re: CDS Picklist Dropdown Allow Blanks and Show Blank if No Value

Hi larspeterson,

 

What do you mean by “all the items in the CDS have no value for this field”? I am not sure with this sentence.


I create several Picklist columns in a custom entity, then create an app based on it.
Both on Edit Form and Display Form, there are default values for each Picklist column.
So it might be not possible to show blank option in the dropdown.

 

A screenshot of my app, on the Edit screen, all the Picklist columns are showing their default value.

1.png

 


Best regards,
Mabel Mao

Highlighted
Level: Powered On
Posts: 5
Registered: ‎12-27-2016

Re: CDS Picklist Dropdown Allow Blanks and Show Blank if No Value

Thanks for your efforts. What I mean by “all the items in the CDS have no value for this field” is that, in the Common Data Service, there are no values in the picklist field for each record. In other words, each record actually has no value for that field. In other words, even though the record has no entry, when I pull the record into the form, it shows up as if "high" were selected.


I wanted to see if I got any easy answer, but I suspect this is not supported yet. I am instead going to create a collection with each picklist and add a blank value, then set the items for the dropdown to the created collection. This is not an ideal solution as I have to manually recreate the picklist and if I ever change the picklist, I will have to update the app. Any other ideas? I can't find a way to collect a picklist. 

Level: Powered On
Posts: 5
Registered: ‎12-27-2016

Re: CDS Picklist Dropdown Allow Blanks and Show Blank if No Value

For any that are curious, my solution has been to create a new Entity called Lists. This entity consists of a description field and then a boolean field for each picklist I want to create. I have allowed blank values for the description field and my first entry in the entity is a blank description field with all boolean values set to true, so it will be in every dropdown.

 

For instance, in the standard Product entity I created a relationship to lists and named it Quality. Then, in my form I delete the lookup dropdown and input a custom dropdown with ProductForm.Items = Filter(Lists, HighModLow = true)


Here is the an excerpt of the Lists table I am referring to:

 

Primary ID 

Description

 HighModLow

000001

 

True 

000002 

high 

True 

000003 

moderate 

True 

000004 

low 

True 

 

I hate hacks, but it is better than not being able to accomplish what I need!