Hi, I am trying to create a related record from a button or “on-click” on the deck component.
I have a model called Events which shows a series of events as cards. On-Click i want to create an Attendee record on another model where the Event Lookup field is populated with the event I have clicked. I cannot work out how to do this, and not matter what I try, I keep populating the field with the first record returned in my event model. Any help would be greatly appreciated.
Hey Adrian, how is it going?
So, you have an interaction on your deck that runs a “Create Row” action to create a new Attendee, right? Then you just click the 3 dots next to that create row action to add a default field value. Choose your Event field, choose single specified value and the value should be {{Id}} (or whatever the Id field from the Events model is named). This template will draw from the row in context (If you use “field from another model” as the value source, it will always pull the first row from the model)
Also make sure both models include the Event Id field.
Let me know if this makes sense and if it works for you! I can get into more details if needed but wanted to make sure you got a quick answer.
Thanks Anna, that worked perfectly! Such a simple thing but I was going around in circles and not getting it. I was spending a lot of my time trying to get this to work with a button set on the deck component which I assume won’t work. I have no done it using the interaction on the card and all good! Thanks so much for your help!
If you add a button set to your deck card - an extra property panel on the buttonset will apper… “Context”. This is where you tell the button set component to only look at the rows from the model that are appropriate for that particular deck card. Set the context correctly - and you will be able to pass the Event ID from that card into your new Attendee record using the button.
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.