function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
maz00maz00 

Picklist setting to none

Hi,

I have many dropdown lists on my aspx pages with the first element being --None-- with a value of "". Every time user selects an item I just do something similar to

Opp.Distributor__c = ddlDistributor__c.SelectedValue;

My questions is how do set it to unselected/not selected?

Opp.Distributor__c = ""  doesn't work?

Thank you
Maz.

darozdaroz

maz00 wrote:

Opp.Distributor__c = ddlDistributor__c.SelectedValue;

My questions is how do set it to unselected/not selected?

Opp.Distributor__c = "" doesn't work?





You need to use the string[] fieldsToNull and pass to it the name(s) of the field(s) you wish to blank.

I.E.:
Opp.fieldsToNull = new string[] {"Distributor__c"};