Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

I have two objects A and B. I have a look up reference of B on A. In certain cases, if the A has B reference, I would want to delete the look up it by making it null or blank, so that I can look up a new B reference on A.

How do I achieve this using soql query?

Thanks, P

share|improve this question
    
What have you tried so far? –  DavinC Aug 22 at 14:59
    
I tried.. A.B__c = ''; update A; looks like this doesn't work.. It says invalid ID.. –  user10930 Aug 22 at 15:00

1 Answer 1

up vote 2 down vote accepted

Based on your last comment, change

A.B__c = ''; 
update A;

to

A.B__c = null;
update A;

'' is an empty string, rather than a null value which is what you need to clear a lookup.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.