You need to sign in to do that
Don't have an account?
Gaurav Jain 67
Unable to compare fields from same Object in SOQL
My scenario is (I need to Add a text 'Opportunity' to end of the Opportunity Name where Opportunity Name is equal to Account Name). I am using following code, but getting error on line 5 that "can compare a String to Account " .. The Field Name for Account NAme is Account and thus I am comparing that ..
******************************
LIST<opportunity> OppList = New LIST<opportunity>();
for(Opportunity O: [select id , name from Opportunity ])
{
if(O.Name==O.Account){
O.Name=O.Name + 'Opportunity';
OppList.Add(O);
}
}
Update OppList;
********************************
Please help
******************************
LIST<opportunity> OppList = New LIST<opportunity>();
for(Opportunity O: [select id , name from Opportunity ])
{
if(O.Name==O.Account){
O.Name=O.Name + 'Opportunity';
OppList.Add(O);
}
}
Update OppList;
********************************
Please help
Gaurav Jain 67
SOLVED: Used O.Account.Name instead of O.Account