Create New Opportunity Starting with a Contact

I’m creating a batch entry process for entering Opportunities. I’d like to start by allowing the user to find/create a Contact. I’d then like to auto-populate the Opportunity’s Primary Contact, Contact Role, and Account based on information from the Contact selected. I also want to use the Contact Name, Amount, and Close Date entered to generate the Opportunity name (e.g. John Doe Opportunity $450 7/5/2016. Would anyone be able to give me some suggestions or sample code get started with this?

Ok.  I’ve done similar things.  Here is a sketch. 

Create models for new contact, new oppty, new opty contact role.  All should “create new record”

Create a model for existing contacts. 

Build a contact table.   With a row action that fires a set of action fwk sequences.  These should be as follows. 

1. Create new row on oppty model that pre-populates account. 
2. Create new row on oppty contact role model that pre-populates contact,  opportunity, role and primary.

Creating the new row in step 1 above will expose a field editor where you can finish the rest of the opportunity data. 

A save button at the bottom of the opportunity does the following actions. 
1. Update field on row.  Choose the Name field and update its value with something like  {{$Model.OppyContactRole.data.0.Contact.Name}} Opportunity {{Amount}} {{CloseDate}} 

Note.  If the save button is on a page title bound to the new opportunity model,  then the amount and close date will be available directly.  (Hence just {{Amount}}.  The contact name however is not directly on the opportunity so you need to use global merge syntax to get the contact name.  


For the “new contact creation branch”  have a button that does “create new contact”   and opens a form (maybe in a popup). 
The save button below the new contact creation form should save the contact and then do a similar set of actions as the row action for the existing contact table above. 

Hope this helps. 

Thanks Rob! I’m working on wrapping my head around this and implementing. Do you have any code snippets you could share to get me on the right track?