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
jOseMCjOseMC 

Expression cannot be assigned &&

Hey guys, I need to do the following, check if the banco__c fields
 and digito_da_conta return null and if they do I have a method that updates this field directly from another object
if(opp.Conta__c = null && opp.Banco__c = null && opp.Agencia__c = null ){
            CheckBankDataOfTheOpportunity(ssi,opp);
        }

   
private void CheckBankDataOfTheOpportunity(SelfSignIn__c ssi, Opportunity opp){
        opp.Agencia__c = ssi.Agencia__c;
        opp.Banco__c = ssi.Banco__c;
        opp.Conta__c = ssi.Conta__c;
    }

 
Best Answer chosen by jOseMC
Abdul KhatriAbdul Khatri
Hi jOseMC

Please change the first code to this single = sign is for the assignment and not for control logic, instead should use ==
 
if(opp.Conta__c == null && opp.Banco__c == null && opp.Agencia__c == null){
    CheckBankDataOfTheOpportunity(ssi,opp);
}

I hope this will resolve the issue.

Thanks

All Answers

AnkaiahAnkaiah (Salesforce Developers) 
Hi,

Can you provide the trigger code, which you have written?


What is the relationship between SelfSignIn__c & opportunity?

Thanks!!
 
Abdul KhatriAbdul Khatri
Hi jOseMC

Please change the first code to this single = sign is for the assignment and not for control logic, instead should use ==
 
if(opp.Conta__c == null && opp.Banco__c == null && opp.Agencia__c == null){
    CheckBankDataOfTheOpportunity(ssi,opp);
}

I hope this will resolve the issue.

Thanks
This was selected as the best answer
jOseMCjOseMC
hi @ankaiah, in my class the two  are related, where one is populated by the other when the other is empty