Tuesday 3 May 2011

Relationship field not working in Trigger.New/Trigger.Old



While  i was working on a trigger i observed one strange behaviour. Lets say there is one custom object "Test__c" which has a look up to Account and the field being 'Account__c'. I performed update operation on Test__c so here is how my trigger would look like

Here though i was sure Name field of Account contains some value the same is not assigned to the string. I tried it many times but always ended up no where with no value being assigned.So instead of directly getting the value from Trigger.New i got the ids of "Test__c" records and then separately queried them to get respective values and to my surprise it worked..


Though strange i dint understand the underlying concept (Totally Dark!!!) .Can some one beam some light on this !!


H C !! 

No comments:

Post a Comment