6 Replies Latest reply on Apr 2, 2009 4:44 AM by toriton

    Setting ProcessVariable as a

      Hi all,

      I have a simple query regarding the access of a process variable in mail node.

      I have used

      executionContext.getContextInstance().setVariable("EmailAddress", "abc@xyz.com");

      in one of my action class.

      Now i want to use this variable for sending mail using mail node. Can you tell me what would be the EL expression in my mail node, which allows to access the variable. Means what should i put in place of question mark below:

      <mail-node name="Mail Customer" to='#{????????}'>

      Test Mail Form JBPM


      Hi!


      </mail-node>

        • 1. Re: Setting ProcessVariable as a

          Please tell me can i use EL in Processdefinition.xml? And if yes, what will be the EL for contextInstance.getVariable("EmailAddress") ?

          • 2. Re: Setting ProcessVariable as a

            Hi,

            In spite of setting the 'to' attribute in the processdefinition.xml, I have found other way out.
            I have tried custome mail class, but jbpm does not delegates the call to my custom mail class, rather it calls its own Mail.class only.
            I have taken a normal node, and written my ActionHandler for the node. In the ActionHandler class i have written the following code...
            -----------------------------------------------------------------------------------
            String to = "abc@xyz.com";
            String text="Success sending mail from jbpm";
            String subject="Test mail from JBPM";

            org.jbpm.mail.Mail mail=new org.jbpm.mail.Mail(null,null,to,subject,text);
            mail.send();
            -----------------------------------------------------------------------------------

            And EUREKA, its working....
            Now i can set the contextVariable as the 'to' attribute without using any EL.

            Please tell me how advisable is this way to send mail?

            • 3. Re: Setting ProcessVariable as a

              I have the same problem.I want to use executionContext.getContextInstance().setVariable("EmailAddress", "abc@xyz.com");

              in one of my action class.
              In the mail node I want to set the to=#{??????} to that variable.
              Can i do it that way?
              pls help its urgent.

              My problem is I have my own tables and dont want to use identity tables.I have three tables user,roles and approver.Now I have mail nodes which will send mail to user and approver accordingly.I dono whether to use swimlanes or what.
              Pls help me out as soon as possible.

              • 4. Re: Setting ProcessVariable as a
                toriton

                hi, i use an Expression for a node mail , to specify the TO parameter, and i think it works perfectly on subject parameter too or text :) (but i don't tried yet).

                This is how it is described in process definition file.


                <mail-node name="mailSender" to="#{mail_address}">

                It work fine for me.
                The value is automatically evaluated from contex , when the workflow approach the node mail.

                I hope this help.
                T.

                • 5. Re: Setting ProcessVariable as a
                  toriton

                  Sorry for double post, but i want reply to Kamleshkr :), about the problem that JBPM not use is custom mail class.


                  ahve you configured the file jbpm.config?
                  where you ahve to specify the new mail class using this:


                  <string name='mail.class.name' value='com.xxx.xxx.MyCustomMailClass' />


                  if you have done :) ,i don't know how to help more.

                  • 6. Re: Setting ProcessVariable as a
                    toriton


                    ... sorry ..

                     <string name='mail.class.name' value='FastSign.mail.Mail' />