Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Matthew Kirschner 323 posts 611 karma points
    Jul 06, 2017 @ 20:13
    Matthew Kirschner
    0

    Access record IDs in the email template

    I know I can add individual form fields to the email template, but how would I go about adding something such as the record ID for each form submission.

    Using the default email workflow, this was accomplished by using the {{recordId}} variable.

    It would also be nice to have access to the form name.

  • Matthew Kirschner 323 posts 611 karma points
    Jul 18, 2017 @ 20:54
    Matthew Kirschner
    1

    Since this doesn't seem to be supported by default, I've created a PR with the added functionality.

    https://github.com/PerplexInternetmarketing/PerplexMail-for-Umbraco/pull/4

  • [email protected] 406 posts 2135 karma points MVP 7x c-trib
    Jul 20, 2017 @ 13:04
    jeffrey@umarketingsuite.com
    1

    Hi Matthew,

    thanks for your PR, it's highly appreciated. Unfortunately we didn't find anytime yet to merge in your PR, so sorry for that. We will get back in contact when we do!

    Thanks,

    Jeffrey

  • Matthew Kirschner 323 posts 611 karma points
    Jul 20, 2017 @ 13:38
    Matthew Kirschner
    0

    Thank you for the package! Umbraco Forms has some major gaps in its email workflow and your package fills them in nicely.

    That PR could use a quick update. It would be useful to have the form name and record date as well:

    // Add form name
    emailTags.Add(new EmailTag("[#formName#]", record.GetForm().Name));
    
    // Add record created date
    emailTags.Add(new EmailTag("[#recordCreated#]", record.Created.ToString(new CultureInfo("en-US"))));
    
    // Add record id
    emailTags.Add(new EmailTag("[#recordId#]", record.Id.ToString()));
    
  • Matthew Kirschner 323 posts 611 karma points
    Jul 24, 2017 @ 14:23
    Matthew Kirschner
    100

    Solved!

    After the most recent commit (thanks, Perplex), the following values are now included in the forms workflow:

    • record id
    • record guid
    • record date / time created
    • form name

    https://github.com/PerplexInternetmarketing/PerplexMail-for-Umbraco/commit/2dffbc46d57879785cf2ce3cb305459eb24b621b

  • [email protected] 406 posts 2135 karma points MVP 7x c-trib
    Jul 27, 2017 @ 07:24
    jeffrey@umarketingsuite.com
    1

    And updated the documentation too, with the new magical tags: https://our.umbraco.org/FileDownload?id=17684.

    • [#formName#]: Inserts the name of the form
    • [#recordCreateDate#]: Inserts the create date of the record without time.
    • [#recordCreateTime#]: Inserts the create time of the record without data.
    • [#recordCreateDateTime#]: Inserts the create time and date of the record.
    • [#recordId#]: Inserts the ID of the record. This will only work when “Post Moderation” in Umbraco Forms is enabled, otherwise it will remain empty.
    • [#recordUniqueId#]: Inserts the GUID of the record.
  • Matthew Kirschner 323 posts 611 karma points
    Jul 27, 2017 @ 14:53
    Matthew Kirschner
    0

    I noticed that the date and time used in the workflow is just a stringified version of DateTime.Now . This will not accurately represent the record created date if the workflow is invoked on form approval rather than form submission.

    Rather, the date and time should come directly from the record itself:

    record.Created.ToString(new CultureInfo("en-US"))
    

    You could take this a step further and check for a null record first (this will happen if Post Moderation is not eneabled), then you could return DateTime.Now.

Please Sign in or register to post replies

Write your reply to:

Draft