function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Cris9931Cris9931 

why i have NULL as result here?

I have the following:
for(SVMXC__SVMX_Event__c svmxEv : Trigger.New)
    {
       
        System.debug('#############' + svmxEv.SVMXC__Technician__r.SVMXC__Service_Group__r.Name);
    }

User-added image


I tried to make a formula field with this: SVMXC__Technician__r.SVMXC__Service_Group__r.Name and it's working... I don't know why in my trigger it's not working...
P.S. my trigger is after update, after insert, before update
Best Answer chosen by Cris9931
vishal-negandhivishal-negandhi

Hi Christian, 

The formula will work alright but in Trigger.New, you can only access fields on the object and ID's of the related records. 

In your trigger.new,  svmxEv.SVMXC__Technician__r.SVMXC__Service_Group__r.Name is available but you need to capture this ID in a collection and then query for other fields.