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
Chris Summers 5Chris Summers 5 

Multiselect lookup field

Hello, I hope someone might be able to provide me some guidance!

I work in an area where we provide training to school districts, and we have recently started building out a tracking system to monitor our technical assistance to the districts. We currently have it where we have an object built which stores districts as record pages, and an object to create technical assistant events as a record. It currently uses a lookup field to link a technical assistant event to the school district. We are hoping to learn how we can make it possibile to link the technical assistant event to more than one school district.  I would like to be able to still have the function of the lookup field to search the school district, but the added ability of attaching a single technical assistant event to a district.

This was if I am out training at District 1 and District 2 I can record that in the same event, not have to create two different events.

I have attached a screenshot of the current new event creation form.

Any help is appriciated, thanks!

User-added image
Best Answer chosen by Chris Summers 5
Andrew GAndrew G
Short answer is yes.  You would need to create the additional junction records manually.  You could make the object simple and use just the two joining fields.  There is the "Save and New" button OR you could leverage the "Clone" button to make creation easier.  ( I do like the Clone button).

To make it so the creation is a one stop shop, you may need to go to a VF page with controller to create the junction objects all at once behind the scenes.

I would maybe do some checking to see the volumnes involved.  For example, if multiple districts for an event is less than 10%, then maybe the manual process would be sufficient. Once it's over 20%, then going to a VF page or similar solution to allow "one stop" creation is a given.

Regards
Andrew
 

All Answers

Andrew GAndrew G
Hi Chris

If the summary of what you are saying is that a "District" can have 1 or more "Technical Assistant Events" and that a "Technical Assistant Event" can be associated with 1 or more "Districts", then you need to investigate junction objects.  
https://help.salesforce.com/articleView?id=relationships_manytomany.htm&type=5

This will then mean that it converts from a field to a related list in each object. 

Other alternative, if this occurance is less than 1%, (for example), then simply a second lookup field on the "Technical Assistant Event" to a "primary district" / "secondary district".   Note, this way will add a level of complexity to any reports you try to create.  

Regards
Andrew


 
Chris Summers 5Chris Summers 5
Hi Andrew, thanks for the quick reply, it looks like you understood what I meant perfectly!

Maybe its my being new to the salesforce worlds and/or my not fulling understanding the function of junction objects. I know they help you linking different objects together, but I'm not understanding how exactly it will allow me to do this on the form. By creation a junction like this how do I accomplish linking it to multiple District on the form. I know currently unless you do custom apex coding a lookup can only select one user/record. How would I accomplish the selecting of District 1 and District 2 when I create a single "Technical Assistant Events"?

Thanks again!
Andrew GAndrew G
Hi Chris
Lucky my dev org has an example of joining objects.
Consider a recruitment app.  In the App I have Objects for Candidate (the person applying) and Position (the job details).
A Candidate may apply to more than one Position.
A Position may have more than one Candidate applying.
So I create a Junction object call "Job Application".
On this object I record (at a minimum), the Candidate and the Position.  But I can also record other data relevant purely to the Job Application.
sample screen shot of job application joining object

When I go to the Position record, I will see a related list of the Job Applications for the position, and I can display detail in the view like the candidate.
sample screen shot of position object showing related list for job applications
Similarly, the Candidate will have a related list of Job Applications that can show the position applied for.
sample screen snippet of Candidate related list showing job applications

In your case, as I think things through, maybe you need to review your model.  I am assuming that a Technical Assistant (TA) Event is an assignment of Technician to District for an "activity" (be that service, support, sales , something).

Is it possible that the TA event now needs to become the joining/junction object?  In that way you can see the number of TA events in a district. And the Number of TA Events attended by a Technician.

If you feel that the TA Event provides some other purpose other than the joining of Technician to District, then you may consider a Junction object called District Events which ties the TA Event to the District.

Hope the above is helpful.
Regards
Andrew
 
Chris Summers 5Chris Summers 5
Hello!
Thanks again for that answer, it helped me understand the junction object a lot better seeing in action like that. You described our situation very well, with one exception, and that is what is giving me the issue. Some of our Technical Assistant (TA) Events might be at a central location where multiple districts attend. In this instance we were hoping there was a way we could record that by only creating 1 event and tie it to multiple districts at the time of creating the event record. 

From my understanding if I wanted to do this through the standard use of the junction object I would have to go to that Event, then the related tab, and add addition districts mannually.
Andrew GAndrew G
Short answer is yes.  You would need to create the additional junction records manually.  You could make the object simple and use just the two joining fields.  There is the "Save and New" button OR you could leverage the "Clone" button to make creation easier.  ( I do like the Clone button).

To make it so the creation is a one stop shop, you may need to go to a VF page with controller to create the junction objects all at once behind the scenes.

I would maybe do some checking to see the volumnes involved.  For example, if multiple districts for an event is less than 10%, then maybe the manual process would be sufficient. Once it's over 20%, then going to a VF page or similar solution to allow "one stop" creation is a given.

Regards
Andrew
 
This was selected as the best answer