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

Update look up field with blank or null.



i want to update the Lookup value as null by using the API call.


In coding I have added null as below.
1.Item.Order_c = null;
2. by declaring Id value as null and assign the id to field.
Order__c ord = new Order__c();
ord.Id = null;
Item.Order__c = ord.Id;
SaveResult[] Update = SFService.update(Item);
But it Update all the fileds but the lookup value remains as before no change in that.
How to assign null value. In UI i can assign null value to the same look up.


Best Answer chosen by Admin (Salesforce Developers) 



i got solution for this.


Item.fieldsToNull = new string[] { "Order_c"};


// call Web Service update method