You need to sign in to do that
Don't have an account?

Commissions pulling correctly, but now I need to cross reference some product data
Hello!
I have a custom object that I am pulling commissions into from another object, incentive_plan. I have products associated to this incentive plan via a related list. I also have users, I can get my trigger to filter via the associated user, but am having a pickle of a time associating the product portion to make sure that this matches. here is what I have so far that saves
trigger CreateCommission on Commissionable_User__c (after insert )
{ for (Commissionable_User__c CU: trigger.new){
Assigned_user__c[] asu = [Select Id, Spiff__c,Percent__c,Incentive_Plan__c From Assigned_user__c Where User__c = :CU.Commissionable_User__c limit 1 ];
Commission__c commission = new Commission__c();
commission.Commission_User_ID__c = CU.Id;
commission.earn_date__c =date.today();
commission.Incentive_Plan__c = asu[0].Incentive_Plan__c;
commission.Percent__c=asu[0].Percent__c;
commission.CommissionSpiff__c=asu[0].Spiff__c;
insert commission; } }
The question is, how to I get data from my other related list Incentive_Products__c to match the related product ID on my commission object? the Product.id is a formula field that is being pulled in from its parent object that hosts the product itself.
Hi Kevin,
The Objects have to be related so that it can be called in the trigger so that it associates the right record.
Regards,
Ashish