Friday, January 13, 2017

Start BPD Types

1.By running the process
2.By UCA
3.By using REST startProcessByName
4.By Using

 tw.system.model.findProcessAppByAcronym('').defaultSnapshot.findProcessByName("Manage Project Documents").startNew(inputs);

have to modify this as readable will make when I have time.


Monday, October 10, 2016

Compare Two Lists

var jurisdictionMap = {};

tw.local.errorMessage = "";

for (var i = 0; i < tw.local.jurisdictionNVP.listLength; i++) {
    jurisdictionMap[tw.local.jurisdictionNVP[i].name] = tw.local.jurisdictionNVP[i].value;

for(var i=0;i< tw.local.clientCashRows.listLength; i++)
    var jurisdictionName = tw.local.clientCashRows[i].jurisdiction;
              tw.local.errorMessage += (tw.local.errorMessage ? ", " : "") + jurisdictionName;
              var errorMessage = "Jurisdiction is not present in table Please verify once " + jurisdictionName;

if (tw.local.errorMessage) {
    tw.local.errorMessage = "The following Jurisdiction are not present in the Jurisdiction Table: " + tw.local.errorMessage;
    tw.local.isError = true;

Tuesday, October 4, 2016

Combine Multiple Statements into one Query(SQL Server)

<# tw.local.parameters = new tw.object.listOf.SQLParameter(); #>

declare @wItemId bigint = ?; <# APCAddSqlParameter(tw.local.parameters, tw.local.wItemId); #>
declare @userName nvarchar(255) = ?; <# APCAddSqlParameter(tw.local.parameters, tw.local.userName); #>
declare @historyLength int = 10;

declare @itemId bigint;
declare @roomId bigint;
declare @homeId bigint;

select top 1
    @itemId = ERP.itemId ,
    @roomId = PRJ.roomId ,
    @homeId = ENG.homeId
from WItem2EntityReportingPeriod WI2ERP
    join EntityReportingPeriod ERP on WI2ERP.entityReportingPeriodId = ERP.entityReportingPeriodId
    join Project PRJ on PRJ.roomId = ERP.roomId
    join Engagement ENG on ENG.engagementId = PRJ.engagementId
where WI2ERP.wItemId = @wItemId ;

update UserActivity
set lastUpdated = CURRENT_TIMESTAMP
where userName = @userName
    and itemId = @itemId
    and roomId = @roomId
    and homeId = @homeId ;

if @@ROWCOUNT = 0
    -- delete old rows for user from UserActivity
    with uaDates as (
        select userActivityId
            , row_number() over (order by lastUpdated desc) as rowNumber
        from UserActivity
        where userName = @userName
    delete UserActivity
    from UserActivity UA
        join uaDates on UA.userActivityId = uaDates.userActivityId
    where uaDates.rowNumber >= @historyLength;

    -- add new UserActivity
    insert into UserActivity (userActivityId, userName, homeId , roomId , itemId , lastUpdated)
    values (next value for UserActivity_Seq, @userName, @homeId , @roomId , @itemId , CURRENT_TIMESTAMP);

Thursday, October 1, 2015

Detect and Handle(Terminate) Infinite loop in javascript IBM BPM

Termination of a infinite loop inside a java snippet inside a bpd is possible in 8.5.5 and later versions

Modify 100Custom.xml file of your process center process server installation.
Network Deployment Cluster - 
                         --> Profile_Root/config/cells/cell_name/clusters/cluster_name/server_type/config/100Custom.xml.

Network Deployment Single Cluster - 
             --> Profile_Root\config\cells\PCCell1\nodes\Node1\servers\server1\process-center\config/100Custom.xml

Update the 100Custom.xml with below xml

<?xml version="1.0" encoding="UTF-8" ?>

          <loop-detection-duration marge="replace">90</loop-detection-duration/>
          <enable-javascript-execution marge="replace">true</enable-javascript-execution/>

Restart the server.

verify the configuration

make sure that settings have made.

This will terminate if any infinite loop found in javascript

I Fixes are avialble for other versions as well

Friday, August 7, 2015

Visibility Inside Coach View

For Coach View components we don't have custom visibility.

 In side Coach visibility options

Inside Coach View visibility options

If we want to add custom visibility inside coach view we don't have default options we have to customize the coach view.

Example Scenario

          we have select and text CV inside coach view. based on selected value we need to show or hide the text coach view.



1.Get the Vertical Section sub-view inside the change event handler.

                              var n1 = this.context.getSubview("Vertical_Section1", true)[0];
2.Get the selected value of select box and compare with your value.if Selected value is yes the shoe the text CV else Hide the CV.
Write the below code in both view and change.when loading and changing the select box this script will apply.

                var n1 = this.context.getSubview("Vertical_Section1", true)[0];

                         var n2 = n1.context.getSubview("Text1", true)[0];
                         var n2 = n1.context.getSubview("Text1", true)[0];


1. When we select Yes we are showing the text CV.
2.When we select No we are hiding the text CV.

Hope this is useful....................

Wednesday, August 5, 2015

Active Instance List

If you want to get the all the active instances for the specified process application.

this TWSearch will return all the active instances.

var col1 = new TWSearchColumn(); = TWSearchColumn.ProcessInstanceColumns.ID;
col1.type = TWSearchColumn.Types.ProcessInstance;

var condition = new TWSearchCondition();
condition.column = new TWSearchColumn(); = TWSearchColumn.ProcessInstanceColumns.Status;
condition.column.type = TWSearchColumn.Types.ProcessInstance;
condition.operator = TWSearchCondition.Operations.Equals;
condition.value = "Active";

var condition2 = new TWSearchCondition();
condition2.column = new TWSearchColumn(); = TWSearchColumn.ProcessColumns.Name;
condition2.column.type = TWSearchColumn.Types.Process;
condition2.operator = TWSearchCondition.Operations.Equals;
condition2.value = "Test";

var search = new TWSearch();
search.columns = [col1];

search.conditions = [condition, condition2];
var order1 = new TWSearchOrdering();
order1.column = col1;
order1.order = TWSearchOrdering.Orders.Descending;
search.orderBy = new Array(order1);
search.organizedBy = TWSearch.OrganizeByTypes.ProcessInstance;
var results = search.execute();
var instaceID[];
 for(var i=0;i<results.rows.length;i++)
                  instaceID[] =  results.rows[i].values[0];


Friday, July 3, 2015

BPM Snapshot Deployment

We have 2 types of deployment 
                        1.Online Deployment
                         2.Offline Deployment

1.Online Deployment:

                  Which PS are connected to process center called online servers.

  Steps to Deploy:

  • Create a snapshot to the application
  • check the online servers in servers tab where you want to install application
  • click the snapshot and install it will show all the offline and online servers
  • select the online server.
  • migrate the instances(leave,migrate)
    • leave - leave the old instances
    • migrate - migrate the current instances
  • installation successful.
  • open the process admin console where you installed the application
  • click on installed application it will list down all the installed snapshots.
  • click on recently installed application and make that snapshot as active and default.

2.Offline Deployment:

            Which PS are not connected to process center called offline servers.

Steps to Deploy:

     Note: Create a offline server 
      1. login to process center
      2. go to server tab.
      3. click 'add new offline server'
      4. enter a name of your choice and create.  
      5. one offline server will display in server tab.                  
  • Create a snapshot to the application.
  • Install the snapshot in offline server.
  • There are two ways to get package from offline server

    •  Click on the Export installation package. it will extract a zip file.
    •  Go to  /opt/ibm/BPM/v8.5/bin folder
    •  logging to WSADMIN python script  
      • wsadmin -conntype SOAP -port 4080 -host -user admin -password admin -lang jython
    • you will see wsadmin> and write the below command to extract the package using command prompt.
      • AdminTask.BPMExtractOfflinePackage('[-containerAcronym BILLDISP -containerSnapshotAcronym SS2.0.1 -containerTrackAcronym Main -serverName processServer315 -outputFile C:/myProcessApps/]')
  • Install the extract package in offline Process server
    • logging inot wsadmin using below command
      • ./ -conntype SOAP -port 8880 -host localhost -user depsadmin  -password depsadmin -profileName DmgrPSProfile -lang jython
    • you will see wsadmin>
      • wsadmin>AdminTask.BPMInstallOfflinePackage('[-inputFile /tmp/ ]')
      • if Package is installed successfully you will see below success message.
      • 'BPMInstallOfflinePackage passed.'

Log location in BPM


tail -f SystemOut.log - To view logs in putty