Skip to main content

I am confused about what line is in context when using a pop up feature with a table. 

I have three models: Events, Attendance, and Contacts. 

The events model is tied to the table with a drawer feature for Attendance and a popup for Contacts. Attendance is connected to Actions via lookup so that field must be filled in.

What should happen is when the Contact pop up is open there is a row action that adds contacts to the Attendance model via the Action framework. Unfortunately, it is only working for the first line in the attendance model and not the row in context (or what I think is context). I put a table from the Event model in the popup to see what line it sees, it shows the correct Event line. However when the record is created in the attendance model it only attaches to the first line in the Event model.

I am using a merge syntax to set the event name: {{$Model.EventModel.data.0.Id}} but it is pulling the first line in the model and not the first line in context.

Any light to shed would be greatly appreciated.




Tami,

Ca you send some screenshots? I’m having trouble picturing the set-up.

A few items which may be helpful in general:

How is the Contacts popup launched? If it’s from a row action on a table, that row will be in context for the popup.

As soon as you create a row with the action framework, that new row becomes the context row.


Hi Tami,

Sometimes you have to create a separate Events model (let’s call it EventInContactPopup) which is used as the Event to which the Contacts in your popup are added.

So, first, create the above model using the Event object and add a filterable default off condition on the ID field. It would also have a 1 row limit and would not load data on page-load. Then, clicking on the popup button on your Events table triggers the following actions:

  1. Take ID of current Event row in table and Activate and Set Value of condition on the EventInContactPopup model

  2. Requery the new event model

You can now assign additional Contacts to your EventInContactPopup Event model.

Once you’ve saved those changes you would then need to also requery the Attendance model.

Apologies in advance if this is not the right solution!


I should have put pictures up to begin with sorry about that. Please let me know if it is clear now.


Here is how it looks to a user:



  • So what should happen is when the plus icon is clicked on the Events Model the Popup with the Contact model is shown (see next screen shot)




  • Here is what the popup looks like (the Attendance and Event model are shown here only for testing)




  • Clicking the wands on the contact model add the contact to the attendance model the action name (Event Model) must be filled in and should be that of the line shown in the Event Model.




  • What is happening is it filling in the Action name from the first row of the Event Model and not the row shown here.




Hi Louis,

Thank you for your input. I understand what you’re saying but I don’t think it will work because I need to save to the Attendance model and I believe you have this saving to the Event model. 

Please let me know if I miss understood your instructions.

Thank you!


Is the attendance model a custom object? What relates Events/Contacts/Attendance together?


Attendance is a custom object. Attendance looks up to Contacts and Attendance looks up to Events. The connection is Attendance.


Hi Tami - I’ve got this working using the following steps. Perhaps there’s an easier way but this one works for me!



If you click on the image you will be able to see the settings more clearly.

To clarify:

  1. The row action on your Events table inserts the ID of that event into a new EventInContactPopup model and queries it. This means you can refer back to this model whenever you want to find the Event ID of the row you clicked to open the popup. There is an initial action which empties the model. This clears the model if subsequent clicks are made on other events.

  2. When you click on the row action on your Contacts table you are creating a new Attendance record using the Contact Id of the row in context, the Event Id of your new model, saving it, and then requerying it so you can see the results in your drawer.

Let me know how you get on!


Also - you can name the new model whatever you want of course!


Louis,

This looks fantastic. I am going to give it a go tonight and I will report back. Thank you for taking the time to run through this for me!


No worries Tami! Someone might step in with a smarter solution but this should get you started. Your issue stems from the {{$Model.EventModel.data.0.Id}} merge field you were using. As I understand it the ‘0’ in this represents the first row of the model. So you will always be getting the first Event in the model when using the above merge field. As such, you need to make your own model which limits the number of events to only the one you are working with. That way, {{$Model.EventInContactPopup.data.0.Id}} will always produce the correct event.


Therein lies my confusion.  I understood the merge syntax was calling the first row of the model but I thought it would take into account if the condition I set up. I think your idea is going to work great. I was thinking I needed another model but I couldn’t wrap my head around what model it should be. It is great to bounce idea’s off of someone. Thanks alot. I will report back when I set up and test.


Louis,

The extra model is exactly what I needed. Thank you so much for your help.

Have a great day!


I’m so glad it worked!

Have a good one!