How to call an email template in generic matter

  • Klaus79
        4 years ago #23715

        Hi all,

        I can only achieve to call a template with explicit name, like Simplifier.Template.<foldername>.<template> where <foldername> and <template> stands for a real existing folder and template.

        How can i use a variable for e.g. <foldername> -> Simplifier.Template[foldername].emailTemplatename (where only “emailTemplatename” exists as template)

        Hope you can help me

         

        Best regards

        Klaus

        Jennifer Häfner
            Has successfully completed the online course Intermediate (200)
            Has successfully completed the online course Advanced (300)
            Has successfully completed the online course Basics (100)
            Has successfully completed the online course Advanced (310)
            Has successfully completed the online course Advanced (320)
            Has successfully completed the Intermediate Certification
            Has successfully completed the Advanced Certification
          4 years ago #24092
          Up
          1
          Down
          ::

          Hi Klaus,

          You can call a template dynamically (e.g. in a server side business object) like this:

          var folder = input.folder;
          var templateName = input.template;
          var template = Simplifier.Template[folder][templateName]();
          output.template = template;

          Note that the template has to exist in both folders.

          Klaus79
              4 years ago #24080
              Up
              0
              Down
              ::

              Is there nobody who knows how to handle it?

              I can’t imagine that a email template can’t be loaded dynamically.

              Klaus79
                  4 years ago #24139
                  Up
                  0
                  Down
                  ::

                  Thank you! It works 🙂

                Viewing 4 posts - 1 through 4 (of 4 total)

                You must be logged in to reply to this topic.