+ Start a Discussion
LALALALALALA 

how to reference data from lookup field

my question is:
I have one custom obj - orderFromweb     : It include such ordernumber, paymentstatus, paymentmethod.......
I have another custom object - orders       : It only include ordernumber field, and company name field from contact  
I wanna through trigger to automatically create an opportunity but i meet some problems

In opportunity have one field is Account Name, this field is reference type, it is lookup field, it has relationship between Account and quote, so I can't get API for this field, only thing I have is AccountId, So how could I get data from account and then fill into this account name field??

Thank you:) 

thank you anyone can help me
sandeep sankhlasandeep sankhla
Hi,

You can collect account id and then you can query on acount to get fields and then you can populate ...

You can share your trigger code so I can help you..

Thansk
 
sandeep sankhlasandeep sankhla
In trigger we can not get parent or any lookup field data directly...we need to collect those ids in a set and then again we need to query on that object and then using maps we can populate the values based on our logic..