You need to sign in to do that
Don't have an account?
Simple Create New Record on Detail Object Trigger Help.
Hello All,
I needed a bit of assistance from the Salesforce community. I have created a a Custom Object called Productivity Allocations. The purpose of this object is to allow users to add more then 1 sales person to any opportunity and split the revenue associated with this opportunity based on the amount of work each sales person has contributed in closing the deal.
Please bare with me as I am mainly an admin who is trying to do some development work. I have done a lot of research on the boards along with the force.com cookbook to get the correct syntax, etc for this Trigger. However I believe I am doing something incorrectly as the Trigger is not functioning as it should.
Relationship:
Opportunity = Master
Productivity Allocations = Detail
Functionality:
Every time a new Opportunity is created I need to create a detail Productivity Allocations record with certain fields filled out.
Here is what I have so far.
Trigger Productivity_Allocation_Insert on Opportunity (after insert) { list<Productivity_Allocations__c> AddPA = new list<Productivity_Allocations__c>(); for( Opportunity o : Trigger.new ){ Productivity_Allocations__c PA = new Productivity_Allocations__c( Opportunity_Name__c = o.Id, Sales_Associate__c = O.OwnerId, Allocation_Percentage__c = 100.00); } insert AddPA; }
Any and all input would be appreciated.
Regards,
Hammad Shah
All Answers
Hello Sirini,
Thank you for the help. That worked out perfectly.
Regards,
Hammad Shah