You need to sign in to do that
Don't have an account?
RJ12
Get Account Name in Opportunity
I'm new to SF Developement. I'm trying to get Account Name in the Opportunity for some scenario.
I'm getting Null value when I'm trying this code
for(Opportunity opp:trigger.New){ if(opp.Quote_Category__c != 'Choose One'){ oppJobList.add(opp.AccountId.Name); } }
Help me on this. Thank you.
replace opp.AccountId.Name with -> opp.Account.Name
Hope this helps...!!
Mark as best answer if the above helps ..!!
If you don't need a lot of data from other related fields and want to avoid a SOQL query, another trick is to make a formula field. You could make a formula field on the Opportunity called 'Account Name' and it's value would be 'Account.Name', then in your trigger you could reference opp.Account_Name__c without doing any additional SOQL queries.
Please mark this answer as correct if it helped you.
You have to change AccountId.Name to Account.Name like this-:
Replace this line oppJobList.add(opp.AccountId.Name);
with this code oppJobList.add(opp.Account.Name);
If you find your Solution then mark this as the best answer.
Thank you!
Regards
Suraj Tripathi