reference field from popup record, not model

  • 1
  • Question
  • Updated 3 years ago
  • Answered
I am launching a popup from a record under one model (Sessions). That popup then displays contacts from a different model (Potential Participants). I'm trying to create actions that will create rows in yet a different model (Session Participants).

When creating a new row, how can I reference the ID from the original record that launched the popup (Session), rather than model displayed within the popup? I only seem to have access to the variables within the popup model, such as {{Contact__c}}, but also need to reference the Session.

Thanks,
Seth
Photo of Seth Leonard

Seth Leonard

  • 662 Points 500 badge 2x thumb

Posted 3 years ago

  • 1
Photo of Seth Leonard

Seth Leonard

  • 662 Points 500 badge 2x thumb
Decided to use a page include, which solved the issue. However, if it can be done via a popup, I'd love to know how.
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Seth...

This is a little bit tricky, but can be done.

Set up a clone of your Session model (call is something like SessionContextRow, but limit it to one record, and don't load it on page load. Create a condition on the Id field, filterable default off.
As part of the action sequence that opens the popup, activate that condition and give it the value of the {{Id}} of the Session that you want to reference, and query the SessionContextRow model.

Then you can use global merge syntax in your popup to reference the values you're looking for:
{{$Model.SessionContextRow.data.0.Contact__c}}.
(Edited)
Photo of Seth Leonard

Seth Leonard

  • 662 Points 500 badge 2x thumb
Thanks, Matt. That's a great solution. At this point, my popup was getting complicated enough that I think the separate page and include probably works better, but I'm glad to have this as a fallback, or to use in similar, simpler setups. Thanks!