Passing an ID to a junction object

  • 1
  • Question
  • Updated 2 years ago
Hi community~

Several people have asked how to have Skuid pass ID's when creating a junction object record.  Glad you asked!  In this scenario, I am using the standard Salesforce objects of opportunities, products, and opportunity products (the junction object as shown from schema builder below).



In order to pass the ID of the opportunity to the new opportunity product record, a specific opportunity must be selected. Here is what my opportunity detail page looks like to the user: 



To add the opportunity product record, the user would click on the Add Product button which on the back end looks like: 


and the popup looks like: 

In this scenario, the popup is connected to a page include. The query string should be as shown: id={{$Param.id}}. This will pass the ID from the opportunity record to the opportunity product record. 

On the front end, the popup my users will see looks like: 


The popup automatically gets filled with the opportunity ID and today's date by following the directions below to put the appropriate conditions on the page include. 

On the page include, there are 2 models: 
Using the condition shown, the first one on the opportunity object pulls in the ID from the opportunity record: 


The second one creates the new opportunity product record using the ID of the opportunity (note the corresponding SF object is OpportunityLineItem):

Add whatever fields you need onto the popup. 

If you want, you can add the opportunity products onto your opportunity page so you can see what products are associated with each opportunity. Here is a simple version of a possible page:



Hope this is helpful!!! 

Thanks!
Karen
Photo of Karen Waldschmitt

Karen Waldschmitt, Official Rep

  • 8,260 Points 5k badge 2x thumb

Posted 3 years ago

  • 1
Photo of mB Roman Melnik

mB Roman Melnik

  • 2,802 Points 2k badge 2x thumb
Thanks Karen! I was trying to remind myself just earlier today how to do this.
Photo of Cody Taylor

Cody Taylor, Documentation

  • 474 Points 250 badge 2x thumb
Thanks to Karen, we've added a thorough step-by-step article for this process on our documentation site!

If you'd like to see more details on this use case, check out this tutorial: http://help.skuid.com/m/supercharge-your-ui/l/558085-add-product-line-items-to-opportunities-with-a-...