About Me

About Me
Working with SOA technologies , implementing solution using IBM BPM , IBM Integration Designer,IBM WODM and IBM DataPower

About me

View Mahesh Dondeti's profile on LinkedIn

upcoming posts on IBM Bluemix,Devops,Worklight,Node js.

Sunday 19 October 2014

How to change EPV and ENV values using JavaScript in BPMV8.5





 How to change  EPV and ENV values using JavaScript in BPMV8.5

Exposed Process Values (EPVs):-

Consider a business process that utilizes some business data value such as the current taxrate or the interest rate on loans. This value is obviously not a constant as it may change over time. What we want is a way to supply such values to processes while at the same time making them easy to modify as needed. The concept of Exposed Processes Values (EPVs) is the IBPM solution.An EPV is a named container that holds one or more variables where the values of those variables can be defined through the Process Administration console.
An EPV is defined within a Process Application or Toolkit from the Data catalog in the library

Environment Variables:-
Instead of hard-coding values in a process, we may wish to externalize these values and re-use them across our solution. IBPM PD allows us to define environment variables in either Process Applications or in Toolkits. Once defined in there, they can then be referenced in the solution

To change EPV values at run time  we have two ways
·        Change  EPV  values  using mange epv  Admin tool in Process Admin console.
·        Change  EPV  values  using Java script.


Change EPV  values  using Java script :-

  1. Create a simple epv with name TestEmail. 
  2. Create a simple human service  to test epvs.
  3. Create the  required variables and link EPV to use  in Human service.
  4. Take server script in Human service and add below code  to set values  to epv.

                     //Assing current date to  tempdate varaible
                       tw.local.tempdate=new TWDate();
                    //set 22 minutes to tempdate(i.e current date )
                       tw.local.tempdate.setMinutes(9);
                   //update epv vaule which can effect on 22nd minute of current day and hour
                      tw.epv.TestEmail.email.update("b@gmail.com",tw.local.tempdate);
                      tw.local.tempdate.setMinutes(28);
                  //update epv vaule which can effect on 28th minute of current day and hour
                      tw.epv.TestEmail.email.update("c@gmail.com",tw.local.tempdate);
                      tw.local.tempdate.setMinutes(30);
                 //update epv vaule which can effect on 30 minute of current day and hour
                      tw.epv.TestEmail.email.update("d@gmail.com",tw.local.tempdate);
                 //Update epv with custom date
                     tw.epv.TestEmail.email.update("e@gmail.com",new TWDate("2015-10-19 11:01:00.0"));

                   
                     //Get epv value at specified time
                     tw.local.test1=String(tw.epv.TestEmail.email.valueAt(newTWDate("2015-10-19 11:30:00.0")));


4.     Create a coach to display values.
5.     Test Human service and verify results  .









Note:-BPMv7.5.0   need install fix to work with above code


Change EPV  values  using Process Admin console :-


Change ENV  values  using JavaScript :-

  • Create  a ENV with name testEnv  at process app setting .
  • Give Default,Developement..etc values .
  • Use below code to change ENV value using java script.

tw.env.update(tw.system.model.env.testEnv, "USA");



I am so thankful to  my friend, who given me this scenario.



1 comment:

  1. Lucky Club - Live Dealer | luckyclub.live
    Lucky Club - Live Dealer. 24 Hours A Day! + 3 Days. Live Casino. Rating: 4.4 · ‎2 votes · luckyclub.live ‎Price range: €/$.00

    ReplyDelete