function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jordan WightJordan Wight 

How can I create a lightning component to create a many to many relationship?

I have created custom objects called Issue and CaseIssue. The Case has a many to many relationship with the Issue object. So the CaseIssue object is a junction object, and the CaseIssue object is a child of the Case.

I would like to create a custom button on the CaseIssue related list, where when I click on it, the modal that presents itself looks like a standard record creation page, but it reality, the user is creating both the CaseIssue and the Issue record.

What is the high level approach to building this? What pages, components, apex code, etc. is needed? Anyone willing to draft some pseudo or sample code? How long do you think this should take an experienced developer? I want to get a high level idea before giving this work to the developer.
Raj VakatiRaj Vakati
You need to use the lightning component and apex class along with the wrapper class to create a many to many records 
  1. Create an apex class along with wrapper class which holds the variable to create many to many records 
  2. Create an lighting component with the UI and you can pass the wrapper class data back to apex class from lightning controller 
  3. Save the data using the DMLs