Announcement

Collapse
No announcement yet.

{{myVariable}} and email template in BPM process

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • {{myVariable}} and email template in BPM process

    Hello,

    in a bpm process, I send an email with a task script, I have an email template that I add to the production script of the mail, I would like to incorporate a variable like {{myvariable}} in it. I have read all the docs, and tried several things, but nothing to do I can't do it.

    I saw that there were fields in the email templates for process and process user task , but no way to get one working,
    not a lot of docs on these fields. I'm probably doing it very badly.

    my temporary solution is to concatenate the mail with fields like:
    $$TEST= "Test";

    $emailBody = string\concatenate('</p><p class="MsoNormal">                          <img src="" style="width: 600px;"><br></p>',
    $$TEST)
    ;
    etc...
    $emailId = record\create(
    'Email',
    'isHtml', true,
    'to', 'XXXXXXXXXXXXXX',
    'status', 'Sending',
    'subject', 'Access info',
    'body', $emailBody
    );

    ext\email\send($emailId);


    Can someone help me to embed the variables in the template?

  • #2
    Hi Stéphane,
    The double dollar sign ($$) before the variable name is needed to call out from a Script Task this variable for either Workflow or BPM actions. In this case you don't need it, so it should have only one dollar sign:
    - When you declare a variable: $TEST= "Test";
    - In the string\concatenate() function: $TEST

    What data do you want to send in the $emailBody?

    Comment


    • #3
      Hi Maximus,

      thank you for your reply,

      initially, I had a "send Message task" with an email template and fields like: {Lead.salutationName} {Lead.firstName} {Lead.lastName} in the template.
      everything was OK.
      My only concern is that I cannot send the email in CC. So I did otherwise by creating an email sending in a "script task".
      Problem my fields in the email template, no longer works.

      I decided to go through variables (declared in the script task) to put them in my email template, I can't do it, then maybe there is another solution?
      or something that i don't do right

      in the body, there is text from the images and some fields from the lead

      sorry for my English

      Comment


      • #4
        Please investigate my script on the screenshot. It works fine and CC adds w/o any problem.
        Attached Files

        Comment


        • #5
          Hi Maximus,

          yes i agree with that,
          I expressed myself poorly. Basically to be simple, I have the same thing as you and my concern is to put my fields in the template, with this "task script", an example :

          {firstName} {name} does not work {assignedUser.name} {Lead.assignedUser.title} same, what to put in the email template
          for these fields ?

          hence the idea of ​​going through variables, but the same, my syntax must not be good

          Comment


          • #6
            I'm afraid it doesn't support to be able to update the template with the variable from Script Task. I tried to do it but w/o success. If you link the email to the template then the system uses the pattern defined in the template rather than your 'body', 'bodyPlain', etc. parameters.
            So, for your purposes, you don't really need to connect the Email Template, cause you can create this 'template' in the Script Task and make things work.

            Comment

            Working...
            X