silverstripe

Silverstripe elemental userforms - Get the FormElement title into the email template


I'm using dnadesign/silverstripe-elemental-userforms in a site and there are lots of different forms, but the email only fires through the fields in the form, so there is no easy way for the client to identify which specific form the email is coming from. Is there a way to get the FormElement Title through to the email/SubmittedFormEmail.ss template?


Solution

  • The Parent relation on the submitted form is your original userform record. So you should be able to get at it from the email template like this:

    $SubmittedForm.Parent.Title
    

    Assuming FormElement is a DataObject that has a Title field and which uses the UserForm trait.