For Trigger.New in an order trigger, I use the order's accountId field to query for 3 fields on the related account. As follows...
for(Order o : Trigger.New)
{
Id theID = o.AccountId;
Account thisAccount = [SELECT Household_Total__c, Household_Children__c FROM Account WHERE ID= :theId];
However, this trigger goes off with a process I'm developing called "Mass Order Create", and as you can tell from the name, I'm making a lot of orders at once. So, this one query in Trigger.new for the account with the given Order's accountID field is putting me over governor limits.
Is there any way to get the related account's fields without querying? If not, what might somebody suggest doing instead?
I found this somewhere that gets fields related to Account, but I don't think it's quite pulling information from a specific record, or if so, the person who provided the code left little explanation, so I don't know how to use it if it's there. (o is trigger.New)
Id theID = o.AccountId;
Schema.SObjectType token = theID.getSObjectType();
Schema.DescribeSObjectResult dr = token.getDescribe();
sObjFieldName = dr.Fields.getMap().keyset();