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
JMPlayer22JMPlayer22 

Boolean always valuating to false even though it's checked

I have an after insert trigger that executes a class when a check box on an opportunity is checked.

 

The problem is.. no matter if the check box is checked or not it always returns false.  I know I'm missing something here but I just can't nail it down.

 

Here's the code:

 

 

trigger ProjectAfterInsertOnly on SFDC_520_Quote__c (after insert) 
{
	for(SFDC_520_Quote__c nProj:Trigger.new)
	{
		if (nProj.Opportunity__r.Phased_Project__c)
		{
			ProjectClass2.PhasedProject(nProj);				
		}
	}	
}

 

 

Pretty straightforward trigger but if I run a debug check against any check box on the opp it returns false as well regardless.

 

What the heck am I missing?

 

Thanks!

 

Jason

Best Answer chosen by Admin (Salesforce Developers) 
SuperfellSuperfell

The trigger context variables do not populate relationships, so nProj.Opportunity__r is null, and so any properties on that relationship are also nil. You'll have to update your trigger to query the related data.