You need to sign in to do that
Don't have an account?
renu
Cannot update Multiselect picklist to null
I had a situtation where i need to update the Multi select picklist to null.
I am checking the condition where if checkbox.checked = false then update muti select picklist to null and also tried passing the empty string. In Both the conditions the value is not getting updated.
If i pass a string value then it is getting updated.
Can someone plz throw an idea.
Thanks
1. Set the value as space character (" ").
2. Set the related specificed field, if any, to true.
Please let us know if it works.
Thanks for the quick response. programmed in the following way
I tried the way you responded. That is working. But i want to store null value in that list. What if i need to run a report in the Dashboard and specify the contact.Direct=null .
Thats the reason why i want to store the value as null instead of passing the string with spaces.(Remember this is not picklist this is a MultiSelect Picklist). and there is no cSpecified for this.
string dmail="Select Direct_Mail__c from Contact where id='" + Session["ContactId"].ToString() + "'";
QueryResult qr2 = binding.query(dmail);
sObject[] records2 = qr2.records;
if (records2.Length > 0)
{
for (int i=0; i<records2.Length; i++)
{
Contact ct=(Contact)records2[i];
if (ct.Direct_Mail__c == null)
{
Session["directmail"]=" ".ToString();
}
else
{
Session["directmail"]=ct.Direct_Mail__c.ToString();
}
case "Add":
CheckBox ch=(CheckBox)(e.Item.Cells[0].FindControl("directMailcb"));
ch.Checked=true;
Contact ct=new Contact();
ct.Id=Session["ContactId"].ToString();
ct.Direct_Mail__c="Yes";
SaveResult[] saveResults = binding.update(new sForce.sObject[] {ct});
}
break;
case "Remove":
CheckBox ch=(CheckBox)(e.Item.Cells[0].FindControl("directMailcb"));
ch.Checked=true;
Contact ct=new Contact();
ct.Id=Session["ContactId"].ToString();
ct.Direct_Mail__c=null; // i need to store the value as null
SaveResult[] saveResults = binding.update(new sForce.sObject[] {ct});
}
break;
I havent used fieldstoNull property can you throw me an idea on that. Thanks again
Message Edited by renu on 08-06-2008 10:37 AM
Contact ct=new Contact();
ct.Id=Session["ContactId"].ToString();
ct.fieldsToNull(new string[] {"Direct_Mail__c"});
SaveResult[] saveResults = binding.update(new sForce.sObject[] {ct});
Message Edited by renu on 08-06-2008 10:43 AM
Thankyou for very quick response. I got the required output.
As this is very urgent requirement which i need to finish up.
And thanks again for all the solutions.
Message Edited by renu on 08-06-2008 12:23 PM
ct.Direct_Mail__c=" ";
Message Edited by renu on 08-22-2008 12:45 PM