Merge syntax for Record Id in Email Alert action

I’m trying to use the Salesforce Email Alert action in the action type “Run data source action.” I’m using the merge syntax {{$Model.CampaignMbr.data.0.Id}} to pass in the Record Id but it isn’t working. I’ve tested that merge syntax in a text component it’s returning the text “sk-temp-record-id-twm-1453” rather than the Record Id. I only have one record in the Campaign Member model and want to use that single record for the Email Alert. How can I pass the Record Id into the Email Alert action?

The value being returned by the merge syntax in the text component is the key here. That was good debugging there! Congratulations.

An Id with “sk-temp=record…” value is for an unsaved record. Its a temporary Id that Skuid creates on new records in order to keep parent / child references inline. When the record is svaed, the temp ID will be swapped with the real ID from the database. Somewhere in your page process a new record is being created on the CampaignMbr model - and of course since that record has not been saved to the database - the Email generator can’t use it.

Look through your model configuration, through model actions, and through other sequences on the page to find where that new row is created.

If you really need that new row in your page - you can have the create action append it to the end of your model (its a setting on the create row action).

Or if you need the new row at the beginning, but want that first saved data row change the index to “1” in your merge syntax.

Or if this is a legitimate new row = and its the one you want to use in your email - save the row before running the email action.

So many options