Problem with custom action and deep database relations

I have a custom action for sending an email via Elastic Email. The action works fine for testing purposes, but when I want to send a notification email to a user email, which is linked through several database relations, the email never gets sent.

My suspicion is, that the value of the email field is not loaded yet when the action is triggered and the Elastic Email API gets called with an empty recipient and rejects the call.

The magic text for the recipient is: Current Meldungen > Fahrzeuge > Werkstatt > User > Email.

Interestingly, when I put the same magic text into a label and wait for it to be loaded, the email gets sent just fine. However, the problem is, that I can’t do this in the use case where I need it because the email should be triggered on the submit button of a create form where the value is not available until the button is pressed.

Could my suspicion be correct and if yes, how can the API call be deferred until the recipient is properly loaded? How else could this issue be resolved?

Hi Wolfgang @silentdrummer,

This is quite interesting. What you describe makes me think that custom actions executions are somewhat asynchronous and don’t require confirmation from the DB… but I have no detailed info on that.
As an option: may be you could try do it in 3-steps? You will need an additional property in Logged-in User collection to store the email, call it TempEmail. Something like:

  • create a new record with this email via long relationships
  • update Logged-in User → TempEmail
  • send email using custom action, but use TempEmail as a recipient’s address.

May be with this you could “simulate” the conditions you see when you use a label.


1 Like

Your suspicion is almost certainly correct.

We do have a card for this internally to be addressed but the current workaround is as already mentioned by having something else load this data in before the custom action is fired so that it is available for that custom action.

Thanks for your responses @Victor and @anon78309838 unfortunately I still haven’t gotten it to work yet.

It seems that none of my actions gets triggered except vor the create action, not even the update of the User to set a Temp field to the desired value. The create comment action doesn’t work, the notification doesn’t work, the custom action doesn’t work. but the Link works.


I think if the first action fails the others don’t take place also.

It’s a bit of a different point to what you discussed, but an issue I see many times with email actions failing is multi-line text, inputted as magic text, being part of the json body. In this case the test usually works but not in the live app when the setup sends a multi-line email body. Probably not your issue but maybe worth checking.

@theadaloguy thanks for the info!

In this case the first action definitely works, since the data is created. The second action should only update the TempEmail value in the Current User object, which doesn’t work. They also don’t work in the test app.

The last action “Link Back” does work however, since the create screen is closed after the button is pressed.

I even completely deleted the form and created a new one, since I already noticed a strange behavior sometimes when copying screens or components that the actions don’t work anymore (which is another bug but apparently not this one) but nothing changed!

With the new form I only tried the workaround suggested by @Victor and left out all other actions, except for the link back.

So now I have:

  • Create the item itself (works)
  • update the temp field in the user object (doesn’t work)
  • Link back (works)

When I use the same magic text on the details view of the newly created component, it does show the desired email after 1-2 seconds.

It seems like the update action also doesn’t work for the value of the magic text to be loaded …

Any other suggestions?

okay, so it seems that even a relatively simple link doesn’t work.
I tried a more shallower value (New Meldungen > Fahrzeuge > Kennzeichen … which is the licence plate in case anybody is wondering) but it also doesn’t show up in the user temp field.
Could it be, that not even the referenced vehicle (Fahrzeug) is loaded after the new entry is created?


also I have to add that this email has already worked in the past, but at some point stopped working when my app got more complex …

I think it would be best to get this in to a ticket so it can go through the correct channels to be addressed.

@anon78309838 okay, i just submitted a ticket (721355685), hope you can fix it. thanks!