create multiple records by clicking on submit button

  • 1
  • Question
  • Updated 4 years ago
  • Answered
  • (Edited)
I am having a "form(new page)" which contains fields like name,email, address, account(lookup), opportunity lookup,campaigns(lookup), a section contains custom fields of another object1 which contains name, date, ... fields.

If i click on "submit" button 

--> It must create an contact(contact must relate to account selected)
--> By using object1 fields it must create a record(using name, date, ... fields) which is seen in related list of contact.
--> In contact relatist list i must see campaign selected.

How can i achieve this without using snippet
Photo of Robin

Robin

  • 270 Points 250 badge 2x thumb

Posted 4 years ago

  • 1
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
What you are trying to achieve is very feasible.  We have written up instructions in this tutorial. 
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,704 Points 20k badge 2x thumb
Need some more information as to how the models are loaded and which order.

Here are some things to consider.
  1. Is the model based on object1 have a condition for the reference field to the Id on the Contact model?
  2. Does the Contact model have the Id field in it?
  3. Is the Contact model and you're Object1 model set to "Create default row if Model has none"?
  4. Is the Contact model and you're Object1 model set to not "Load Model data on page load" 
  5. Is the Contact model first in the Models tab in the page builder?
If all these are set, then you should be able to use one "Save Models" action to get the related record in Object1 to show in the Contact related list.

Campaign membership is a whole other animal. This requires the use of CampaignMember junction object.
https://www.salesforce.com/developer/docs/api/Content/sforce_api_objects_campaignmember.htm
  1. Create a model for CampaignMember.
  2. Set to "Create default row if Model has none"
  3. Set to not "Load Model data on page load" 
  4. A condition for ContactId to equal the Id on the Contact model.
  5. Add this model to the "Save Models" action.
Then you should be able to assemble the Field Editor components on your page with all Save/Cancel buttons removed and one Page Title component Save/Cancel button.
Photo of Robin

Robin

  • 270 Points 250 badge 2x thumb
1. Yes i am having a condition for the reference field to the Id on the Contact model
2. I am having ID field in contact

3. Contact model and Object1 model set to "Create default row if Model has none"

4. Contact model and Object1 model set to not "Load Model data on page load" 

5. Contact model is 1st in page builder and followed by object1 model.

But i am struck how to proceed to next step??
I am new to skuid and want to use multiple actions to create multiple records .
Can any one please help me out steps to proceed much further
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
I assume that Object1 is the actual related list you want populated in the contact record.  This is the way it should work.  There is no need to create a separate object just for the data capture.  Use the actual objects in which the data will be stored. 

Then complete your form with the following. 

6. create a condition on object1 model that makes its ContactID = to the ID of the Contact model (Field from another modely condition type)

7. Create a new model on Campaign member just as you have done with the object 1 model.   Give it a similar condition. 

8. Create your field editors and tables for data entry.  They should be in "Edit mode" 

9. Add a page title at the top of the page and add a "save / cancel" button.  Add all your models to the save action. 

For more details look at the tutorial I provided you.