Product is related to Parts thru a junction object 'ProductPartUse' so its Product -> ProductPartUse <- Part. I want the user to select multiple Parts and lookup to a single Product and have all Parts be assigned to the Product thru the Junction Object ProductPartUse. I think we may have to use a visual force page or a lightning component with Apex code to accomplish this. If someone can help point to some existing sample code or help me get started. Thanks
Asked
Active
Viewed 699 times
-1
-
Trailhead is a great place to start if you're not familiar with a Salesforce technology yet. Trailhead includes modules on both Lightning components and Visualforce. As written your question is too broad to have a specific answer. – David Reed Jan 15 '21 at 16:50
-
Thanks David. Sorry I got a bit busy. I found an example online with the Visualforce UI where it lets you search for multiple records based on a string entered, then you list of values (parts) are displayed with checkboxes to the right, from which you can select multiple parts, but I need to go further and process the selected records and associate them to a single Product thru the junction object. I am not sure how to know what values where selected and use them in Apex. https://www.forcetree.com/2009/07/database-search-and-selection.html – DataEagle Jan 19 '21 at 06:19
1 Answers
0
You do not need to write custom code in VF/Aura/LWC. This can be accomplished using standard functionality with ProductPartUse
sObject having two master-detail relationships (one to Product
and one to ProductPartUse
). The interface would not be as easy for the user, because they would need to do one ProductPartUse
record at a time. If you want to have one screen where they can simultaneously select multiple parts and associate it with a product, then yes... you do need custom code. I would suggest you build it using LWC because the other 2 technologies are old (not deprecated, but not as cool). But if you are not comfortable with code, then look into flows.

Andres Perez
- 46
- 2
-
Thanks Andres for the reply. I found this https://www.forcetree.com/2009/07/database-search-and-selection.html and I was able to add a button and on click goes to this visual force page but need to go further and process the records selected in apex to associate them to Product thru junction obj. I think I can figure out the apex part but not sure how to retrieve the selected parts on the visualforce page. Can you point me to an example on trailhead or some sample lines that will allow me to know the selected records and pass to Apex. Thanks – DataEagle Jan 19 '21 at 06:20