You need to sign in to do that
Don't have an account?

query account record type from opportunity
I have a trigger on Opps and need to execute some logic if the opp is associated to only one Account Record type. How do I do this?
trigger UpdateTeamMember on Opportunity (After insert, after update) {
if(trigger.isUpdate){
for(opportunity o : trigger.new){
if(o.account.recordtypeid == 'xxxxx') >> does not work?
Any ideas?
trigger UpdateTeamMember on Opportunity (After insert, after update) {
if(trigger.isUpdate){
for(opportunity o : trigger.new){
if(o.account.recordtypeid == 'xxxxx') >> does not work?
Any ideas?
There is multiple ways to get record Type Id. By using schema class, you can achieve this.
For your scenario you can use above code either, you can achieve by following way – Let us know if it helps you.
Regards,
Yogesh More
more.yogesh422@gmail.com || Skype:-yogesh.more44
All Answers
Thanks
As of now(without knowing the requirement), I would prefer to using formula field. Because, you need to loop two times and one query to get recordtypeId.
sequence will be:
trigger.new loop 1: Store the Account values.
Query the RecordTypeId for stored Account values in map.
trigger.new loop 2: compare the recordtypeId value to do the rest of operation.
Thanks,
Alex Ezhilarasan
There is multiple ways to get record Type Id. By using schema class, you can achieve this.
For your scenario you can use above code either, you can achieve by following way – Let us know if it helps you.
Regards,
Yogesh More
more.yogesh422@gmail.com || Skype:-yogesh.more44