3 Replies Latest reply on Apr 6, 2012 4:36 AM by Maciej Swiderski

    [SOLVED] - Obtain taskInstance variables in mail template

    Francesco Stampacchia Newbie

      Hello everyone,

      I'm providing a workflow service that notifies on every step a business mail.

       

      I need to obtain in the mail template the task variables that come with the managed taskInstance. Is it possible to obtain them perhaps in the following way  {taskInstance.variables.variable_name}?

       

      Thanks in advance.

        • 1. Re: Obtain taskInstance variables in mail template
          Maciej Swiderski Master

          How do you send these emails? With jBPM or you have another component that does that? If you use jBPM for this you have access to process variable that can be referenced in the template.

           

          If you could elaborate a bit more about your case there is a bigger chance to get some ideas.

           

          Cheers

          • 2. Re: Obtain taskInstance variables in mail template
            Francesco Stampacchia Newbie

            Hello!

             

            Well, using a mail template I'm naturally relying on the notify parameter specified in the task node xml definition, like this:

             


            <task-node name="Draft">


            <task name="program_defined" swimlane="PM" description="DRAFT" notify="true"></task>


            <transition to="Active" name="validate"></transition>

            </task-node>

             

            As such, I'm using an xml template in which I can invoke my processInstance properties and variables.

            I.e. with #{taskInstance.actorId} to obtain actorId in my mail template.

             

            By the way, my issue was solved as I thought. Infact, if you carry a set of variables with your taskInstance, you can retrieve them by calling them in this way:

             

            #{taskInstance.variables.variable_name}

             

            where variable_name is the key name used to store your variable in the taskInstance.

            Hope this can be useful to someone else!

             

            Cheers!

            • 3. Re: Obtain taskInstance variables in mail template
              Maciej Swiderski Master

              Alright, good to hear it is solved. I thought we were talking about jBPM5 and as I can see it is previous version.

               

              Please mark the post as answered so others can benefit from it.

               

              Cheers