new at Apex having an issue with creating a trigger. I'm trying to update the value of a picklist depending on if a checkbox is checked in Carrier_Product__c. I know you cannot do this method, and it relies on another lookup where it won't return null. Here's what I have, thank you.
trigger ShellPolicyRebalance on Quote_Policy__c(before insert) {
for (Quote_Policy__c p: Trigger.new) {
if (p.RecordTypeId == Schema.SObjectType.Quote_Policy__c.getRecordTypeInfosByName().get('Shell Policy').getRecordTypeId()) {
if (p.Carrier_Product__r.Rebalance__c) {
p.Renewal_Flow__c = 'Rebalance';
}
}
}
}