You need to sign in to do that
Don't have an account?
Shawn Reichner 29
Create Opportunity for Child Accounts when child created using info from parent account opportunity
I have a process that based on checkboxes on the Account object when the Account is created, it will create a child account for the Parent account being created. This will usually be done during the lead conversion process where the Account gets created and based on the checkboxes selected on the lead the approprate Child Accounts will be created. Now here is my question.....When the lead conversion is successful and the opportunity is created for the parent account, I would like a trigger to based on the two check boxes on the Parent account (Anywhere or Complete) to create an Opportunity using the same field data from the opp created by the lead conversion for each child account created with a small tweak to the name field and re-pointing the Account ID on the new child opps to point to thier correct Child account again base don the proper checkbox selected and the trigger process. Can this happen? If so, can you give me a head start as I woudl like to get this automated and I know we can do this, but I have no idea.
Please be my saving hero!!!!
Thanks in advance,
Shawn
Please be my saving hero!!!!
Thanks in advance,
Shawn
This is possible. All you need to do is write a trigger on Account (Event after insert) ( please apply condition in trigger that parent ID is not null) to create opportunity (populating child account's id on opportunity along with tweaking opportunity name).
Please mark this best answer if it was helpful for you to resolve your issue.
Thanks
Sandeep Singhal
http://www.codespokes.com/
Thanks again,
Shawn
Please replace your line #10 as below
Opportunity[] ParentOpplist = [SELECT ID, AccountId FROM Opportunity WHERE AccountId =: a.ParentId LIMIT 1];
Opportunity ParentOpp = new Opportunity();
if (ParentOpplist .size() > 0)
ParentOpp = ParentOpplist [0].Id;
but also try to find reason why this soql does not has any record to return.
Please mark this best answer if it was helpful for you to resolve your issue.
Thanks
Sandeep Singhal
http://www.codespokes.com/
if (ParentOpplist .size() > 0)
ParentOpp = ParentOpplist [0];
Thanks
Sandeep Singhal