You need to sign in to do that
Don't have an account?
apsullivan
Visualforce Page to Create Case with A Dynamic Number of Child Records
I would like to create a Visualforce page which allows a user to create a Case and multiple child records (called Case Campaigns) at once.
The problem I am trying to solve is that we want to use Cases to setup new campaigns, and have it be only one case per setup, but be able to define multiple budgets for each device. So for example, one case for a setup, but 4 devices with 4 different budgets. The best way I can think to achieve this is by using child records on the cases to represent the specific details on a granular level, but creating them one-by-one is time-consuming and tedious. I want the user to be able to create them all on one page along with the new case.
Ideally, the flow works as follows:
I would love a code example if anyone has written a blog post anywhere or has faced such a challenge in the past. Thanks very much in advance!
The problem I am trying to solve is that we want to use Cases to setup new campaigns, and have it be only one case per setup, but be able to define multiple budgets for each device. So for example, one case for a setup, but 4 devices with 4 different budgets. The best way I can think to achieve this is by using child records on the cases to represent the specific details on a granular level, but creating them one-by-one is time-consuming and tedious. I want the user to be able to create them all on one page along with the new case.
Ideally, the flow works as follows:
- User clicks on a button to create a new case which redirects to this VF page
- The Case has 4-5 "core" fields that are just Case fields as I've defined them
-
The user selects a number from a Picklist Field called "Number of Campaigns"
- Eg. The user selects the number "5" in the Picklist
-
The page then reloads a block that shows the number of Case Campaigns listed as line items
- Eg. There are now 5 lines, each with a device and a budget
- The user performs a save, which inserts the new Case and the new Case Campaigns at once
I would love a code example if anyone has written a blog post anywhere or has faced such a challenge in the past. Thanks very much in advance!
Try the Clone function which can be called to create and insert new records,
See the below links for code and more information,
Insert,Edit,Delete,Clone Records for an object from Vfpage
http://flexandsalesforce.blogspot.com/2011/07/inserteditdeleteclone-records-for.html
Apex “Deep Clone” Controller
http://blog.jeffdouglas.com/2009/11/19/apex-deep-clone-controller/
Regards,
Ashish