Showing posts with label IBM. Show all posts
Showing posts with label IBM. Show all posts

Sunday, October 23, 2022

DB2 Replication Options

 Replication Options

1) Db2 High availability disaster recovery (HADR): 
Active/Passive Replication, supports up to three remote standby servers.
when active DB Down, With HADR, a standby database can take over in seconds.  the original primary database can be brought back up and returned it to its primary database status, which is known as failback. A failback can be initiated when the old primary database is consistent with the new primary database. After reintegrating the old primary database into the HADR setup as a standby database, the database roles are switched to enable the original primary database as the primary database.





2) Db2 pureScale: designed for continuous availability,  All software components are installed and configured from a single host. pureScale scaling your database solution using Multiple database servers, which are known as members, process incoming database requests; these members operate in a clustered system and share data. You can transparently add more members to scale out to meet even the most demanding business needs. There are no application changes to make, no data to redistribute, and no performance tuning to do.



3) IBM Info-Sphere Data Replication product (IIDR): 

IIDR has three alternative components

  1. Change data capture (CDC): for heterogeneous databases, ie, replication between Oracle and DB2.
  2. SQL Replication: old way, used in broadcast topology, create staging tables in source DB which cost increase DB size to capture all DB changes.
  3. Q Replication: use IBM MQ, capture all DB changes inside MQ, high volume, low latency.






    Q Replication: the best solution in IIDR

    Q Replication is a high-volume, low-latency replication solution that uses WebSphere MQ message queues to transmit transactions between source and target databases



    Q Replication High availability scenarios

    1. Two-nodes for failover: Update workloads execute on a primary node, Second node not available for any workload
    2. Two-nodes with one read-only node for query offloading: Update workloads execute on a primary node, Read-only workloads are allowed on a second node
    3.  Two-nodes, Active/Active, with strict conflict rules: Update workloads execute on two different nodes, Conflicts are managed, Deployed only when conflicts can be carefully managed.
    4. Three-nodes with at least one read-only node: Update workloads execute on a primary node, Read-only workloads execute on second and third nodes, Conflicts are tightly managed
    5. Three-nodes, Active/Active, with strict conflict rules: Update workloads execute on three different nodes, Conflicts are managed, using data partitioning, workload distribution, use when have unstable/slow connection topologies.


    Q Replication components

    1) The Q Capture and Q Apply programs and their associated DB2 control tables (listed as Capture, Apply, and Contr in the diagram)

    2) The Administration tools that include the Replication Center (db2rc) and the ASNCLP command-line interface

    3) The Data Replication Dashboard and the ASNMON utility that deliver a live monitoring web tool and an alert monitor respectively

    4) Additional utilities like the ASNTDIFF table compare program and the asnqmfmt program to browse Q Replication messages from a queue WebSphere MQ


    Notes:

    - The Q Capture program is log-based
    - The Q Apply program applies in parallel multiple transactions to the target DB2
    - The Q Capture program reads the DB2 recovery log for changes to a source table defined to replication. The program then sends transactions as WebSphere MQ messages over queues, where they are read and applied to target tables by the Q Apply program.
    - Asynchronous delivery: Q Apply program receive transactions without having to connect to the source database or subsystem. Both the Q Capture and Q Apply programs operate independently of each other—neither one requires the other to be operating.



    InfoSphere Information Server

    InfoSphere Information Server is an IBM data integration platform that provides a comprehensive set of tools and capabilities for managing and integrating data across various sources and systems. It is designed to help organizations address data quality, data integration, data transformation, and data governance challenges.

    InfoSphere Information Server enables businesses to access, transform, and deliver trusted and timely data for a wide range of data integration use cases, such as data warehousing, data migration, data synchronization, and data consolidation. It offers a unified and scalable platform that supports both batch processing and real-time data integration.


    Key components of InfoSphere Information Server include:

    1) DataStage: A powerful ETL (Extract, Transform, Load) tool that allows users to design, develop, and execute data integration jobs. It provides a graphical interface for building data integration workflows and supports a wide range of data sources and targets.

    2) QualityStage: A data quality tool that helps identify and resolve data quality issues by profiling, cleansing, standardizing, and matching data. It incorporates various data quality techniques and algorithms to improve the accuracy and consistency of data.

    3) Information Governance Catalog: A metadata management tool that enables users to capture, store, and manage metadata about data assets, including data sources, data definitions, data lineage, and data ownership. It helps organizations establish data governance practices and provides a centralized repository for managing and searching metadata.

    4) Data Click: A self-service data preparation tool that allows business users to discover, explore, and transform data without the need for extensive technical skills. It provides an intuitive and user-friendly interface for data profiling, data cleansing, and data enrichment.

    5) Information Analyzer: A data profiling and analysis tool that helps assess the quality, structure, and content of data. It allows users to discover data anomalies, identify data relationships, and generate data quality reports.

    InfoSphere Information Server provides a comprehensive and integrated platform for managing the entire data integration lifecycle, from data discovery and profiling to data quality management and data delivery. It helps organizations improve data consistency, data accuracy, and data governance, leading to better decision-making and increased operational efficiency.








    for more information visit
    https://www.youtube.com/watch?v=U_PN8QLTec8



    Sunday, May 2, 2021

    WebSphere Application Server Components

    Cell

    • - Node 1
      • -- Profile
        • ---App Server 1
        • ---App Server 2
        • ---One Deployment Manager

    • - Node 2,3,4,..
      • -- Profile
        • ---App Server 1
        • ---APP Server 2
        • ---Node Agent 




    Node

    Each machine/operating system instance with an IP address or hostname is a “node“. 

    The list of nodes in your WebSphere environment may be seen in the ISC under “System Administration/Nodes”. On a node there may be one or multiple servers.
    A server is a Java Virtual Machine (JVM) process meaning that it may be controlled individually and it may have memory assigned to it and have specific JVM parameters set if required.
    Please note that having multiple servers on a single node is very common in WebSphere Application Server.


    Profile

    When a server is created in WebSphere Application Server it is created using a profile which basically is a template for the server. There are two main profiles to worry about – “default” which is an server to run applications and “dmgr” which is the deployment manager.

    Deployment Manager
    In an architecture with multiple nodes the deployment manager is the administration server that controls the nodes it knows about including making sure that the configuration is synchronized between the nodes.

    Cell
    The nodes belonging to a single deployment manager belongs to the same cell. In other words there is a single deployment manager per cell.


    Managed vs Unmanaged Nodes
    Looking back at the nodes a node may be managed or unmanaged.
    A managed node is a WebSphere node that the deployment manager can talk to and send commands.
    An unmanaged node is the opposite. WebSphere knows about the node but cannot communicate with it on a WebSphere protocol. 


    IHS
    IBM HTTP Server (IHS) is WebSphere unmanaged node.


    Node Agent
    If a node is managed it will have a nodeagent installed. The nodeagent is a separate Java process which is started and stopped individually and separate from any server. The nodeagent can be used to synchronize the configuration to the node and to start and stop “stuff” on the node. The nodeagent may be configured to start all the servers running on it when ever it starts. On servers the administrator may install applications which run on the server. The applications may be started and stopped individually but usually all applications start and stop with the server.


    Cluster
    For high availability you may choose to create a cluster of servers. Servers in a cluster runs the same applications and can take over from one another. Note that you cluster servers and not nodes so you could have a cluster of three servers on a single node.


    So…


    If you have an IBM Connections installation where everything is installed on the same Linux or Windows box and you chose the “small deployment” which puts all applications into the same server you will have the following:


    A single cell

    A single deployment manager controlling your cell

    Three (3) nodes. One for the deployment manager, one for the server running the IBM Connections applications (managed node) and one for the IBM HTTP Server (IHS) (unmanaged node).

    A single nodeagent

    A single server running all the applications

    A single cluster with the server

    Three (3) JVM processes running – one for the deployment manager, one for the nodeagent and one for the server

    Saturday, May 1, 2021

    How to Install/Uninstall IBM Websphere?

     How to install Websphere?

    Installation steps:

    1- Installation Manager [assume found in /root/WAS/IM folder]

    2- Websphere Application Server [/root/WAS/WAS folder]

    3- Webserver (HTTP) Server [/root/WAS/webserver folder]

    4- Webserver Plugins [/root/WAS/webserver-plugin folder]


    Notes: 

    - Default instalation path is /opt/IBM

    - if the packages inside folders are zip just run command-->  unzip <packageName>.zip


    Install "Installation Manager"

    cd /root/WAS/IM

    cd tools

    ##./imcl install <PackageName>, in our case <PackageName>=com.ibm.cic.agent

    ./imcl install com.ibm.cic.agent -repositories /root/WAS/IM/repository.config -acceptLicense -showProgress


    Now, Installation Manager should be found on /opt/IBM/InstallationManager


    To install Websphere Application Server

    cd /opt/IBM/InstallationManager/eclipse/tools


    ./imcl -listAvailablePackages -repositories /root/WAS/WAS/repository.config

    the output of the previous command is the <PackageName> that we need to install


    ./imcl install <PackageName> -repositories /root/WAS/WAS/repository.config -acceptLicense -showProgress -record install_was.xml


    To Install WebServer

    cd /opt/IBM/InstallationManager/eclipse/tools

    ./imcl -listAvailablePackages -repositories /root/WAS/webserver/repository.config

    the output of the previous command is the <PackageName> that we need to install


    ./imcl install <PackageName> -repositories /root/WAS/webserver/repository.config -acceptLicense -showProgress -properties user.ihs.httpPort=80 -record install_webserver.xml



    To Install WebServer-Plugin

    cd /opt/IBM/InstallationManager/eclipse/tools

    ./imcl -listAvailablePackages -repositories /root/WAS/webserver-plugin/repository.config

    the output of the previous command is the <PackageName> that we need to install


    ./imcl install <PackageName> -repositories /root/WAS/webserver-plugin/repository.config -acceptLicense -showProgress 


    after install plugins we should define it inside the webserver

    cd /opt/IBM/WebSphere/Plugins/bin/65bits

    get the plugin names normally it is xxx.so


    then

    cd /opt/IBM/HTTPServer/conf

    nano httpd.conf

    under loadModule section define plugin name with its path


    To uninstall items just use the next command

    cd /opt/IBM/InstallationManager/eclipse/tools

    ./imcl uninstall <PackageName> 


    after uninstall packages you can remove its folder by run the next command

    rm -rf *


    Wednesday, August 14, 2019

    Configure IBM WebSphere Application Server Heap Size

    A common issue with Low heap size is an out-of-memory error. If you are deploying a very large application using the administrative console, it can fail with out-of-memory error. In this case, you need to increase the maximum Java heap size value of the Deployment Manager and the Node Agent.

    How do you change the Java heap size settings?
    The JVM heap size settings can be changed from the administrative console using these steps:
    Expand Servers > Server Types > WebSphere application servers and click your server name.
    Click Java and process management > Process definition > Java virtual machine.
    The JVM Heap size can be adjusted by using the Xms: Initial Java Heap Size and Xmx: Maximum Java Heap Size command-line parameters.










    We also can add -Xss512m parameter to java args


    Saturday, July 6, 2019

    IBM FileNet Case Manager Script adapter

    Set New Case Default Values when create new case

    Pages > Add Case > Add Script Adapter widget > make it hidden > edit wiring

    "Page Container " : "SendNewCaseInfo" > "Receive event payload"




    window.myPayload = payload;
    window.solutionPrefix= this.solution.getPrefix();

    var editable = myPayload.caseEditable;
    alert(editable);
    if(editable != null){
    require(['icm/model/properties/controller/ControllerManager'],
    function(ControllerManager) {
    var collectionController = ControllerManager.bind(editable);
    collectionController.beginChangeSet();

    //Get Current User Name
    var PortEmployeeName = ecm.model.desktop.userDisplayName;

    //Set as default value for textbox PortEmployeeName
    collectionController.getPropertyController(solutionPrefix + '_PortEmployeeName').set('value',PortEmployeeName);

    collectionController.endChangeSet();
    ControllerManager.unbind(editable);
    });
    }


    Show Hide field based on another field value 


    var solution = this.solution;
    var prefix = solution.getPrefix();

    require([ "icm/model/properties/controller/ControllerManager"]
    , function( ControllerManager)
    {


      workItem = payload.workItemEditable;
      this.collectionController = ControllerManager.bind(workItem);


      this.collectionController.getPropertyController(prefix+"_PROJECTMILESTONDATES").watch("value", function(value){
          if (value === "1"){
            collectionController.getPropertyController(prefix+"_REVIEWUSERS").set("hidden", true);
          } else {
            collectionController.getPropertyController(prefix+"_REVIEWUSERS").set("hidden", false);
          }
      });


    });



    Add button beside textbox 

    search for textbox that has placeholder = "project_name" and add button beside it



    dojo.query("input[placeholder='project_name']").forEach(function(item)
        {
                  item.offsetParent.offsetParent.insertAdjacentHTML('beforeend', "<input type=button value=? class=btn >");
        });


    Add Case Custom validation before save

    • // Add a Script Adapter to your Add Case page and hide it
    • // Wire the incoming event for the Script Adapter from the Page Container's Send New Case Information event
    var coord = payload.coordination;
    var caseEdit = payload.caseEditable;
    var solution = this.solution;
    var prefix = solution.getPrefix();
    
    require(["icm/base/Constants", "icm/model/properties/controller/ControllerManager"], function(Constants, ControllerManager){
    
    if(coord){
    
    /*Participate in the VALIDATE coordination step*/
    
    coord.participate(Constants.CoordTopic.VALIDATE, function(context, complete, abort){
    
    if(context[Constants.CoordContext.CASE]){
    
       /*Check work item property attribute's value*/
    
       var propId = prefix + '_Description';
    
       /*Retrieve prop value(s) using property controller API*/
    
       var theController = ControllerManager.bind(caseEdit);
       var propController = theController.getPropertyController(propId);
       var value = propController.get("value");
    
       /*Unbind is necessary to prevent mem leak.*/
    
       ControllerManager.unbind(caseEdit);
    
       if(value === null || value === undefined || value === ""){
    
          /*Abort the page completion with passing a message to user*/
    
          abort({"message":"Please enter a description before adding the case."});
       }else{
          complete();
       }
     }else{
        complete();
     }
     });
    }
    });


    Workitem data validation
    based on which step response is selected


    • Add a Script Adaptor widget to the hidden widgets area on a work details page
    • Wire an inbound event from the Page Container's Send Work Item to the Script Adaptor's Receive Event.
    • The additional data validation logic will be triggered when the appropriate response button is clicked.
    var coord = payload.coordination;
    var workitemEdit = payload.workItemEditable;
    var solution = this.solution;
    var prefix = solution.getPrefix();
    
    require(["icm/base/Constants", "icm/model/properties/controller/ControllerManager"], function(Constants, ControllerManager){
    
    if(coord){
    
    /*Participate in the VALIDATE cordination step*/
    
    coord.participate(Constants.CoordTopic.VALIDATE, function(context, complete, abort){
    
    /*Check the specific response, an empty string ("") stands for the Complete button*/
    
    if(context[Constants.CoordContext.WKITEMRESPONSE] === "Investigate"){
    
       /*Check work item property attribute's value*/
    
       var propId = prefix + '_Description';
    
       /*Retrieve prop value using property controller API*/
    
       var theController = ControllerManager.bind(workitemEdit);
       var propController = theController.getPropertyController(propId);
       var value = propController.get("value");
    
       /*Unbind is necessary to prevent mem leak.*/
    
       ControllerManager.unbind(workitemEdit);
    
       if(value === null || value === undefined || value === ""){
    
          /*Abort the workitem completion with passing a message to user*/
    
          abort({"message":"Please enter a description before sending for investigation."});
       }else{
          complete();
       }
     }else{
        complete();
     }
     });
    }
    });








    Hiding Attachment widget based on some property

    //var coord = payload.coordination;
    //var caseEdit = payload.caseEditable;
    //var solution = this.solution;
    //var prefix = solution.getPrefix();

    if (payload.eventName === "icm.SendWorkItem" )
    {

    var coordination = payload.coordination;
                         
    var workEdit = payload.workItemEditable;

                     
    if(workEdit.icmWorkItem.stepName === "Request for PreSubmission Meeting")
        {         

    require(["icm/model/properties/controller/ControllerManager", "icm/base/Constants","ecm/model/Repository"],function(ControllerManager, Constants,repository)
                {         
                    coordination.participate(Constants.CoordTopic.AFTERLOADWIDGET, function(context, complete, abort)
                    {
                                         
                        var collectionController = ControllerManager.bind(workEdit);
                        var Controller = collectionController.getPropertyController("CPA_VarHideAttachment"); // CPA_VarHideAttachment Case property
                     
                        var HideAttachment = Controller.get("value");
             
                        if(HideAttachment == "Yes")
                        {
                        dojo.query("span").forEach(function(item)
                            {
                                if(item.innerHTML==="Attachments")
                                    {
                                        var prnt = item.parentNode.parentNode.parentNode.parentNode.parentNode;
                                        prnt.style.display = "none";
                                    }
                            });
                        }
                            complete();
                 
                    });
                 
                    /* Use the AFTERLOADWIDGET coordination topic handler to release the controller binding for the editable. */
                    /* Since the prop controller can be shared, doing this in the AFTERLOADWIDGET ensures no other widget overrides your changes. */
                 
                    coordination.participate(Constants.CoordTopic.AFTERLOADWIDGET, function(context, complete, abort) {
                        /* Release the controller binding for the editable. */
                        ControllerManager.unbind(workEdit);
                     
                        /* Call the coordination completion method. */
                        complete();
                    });
                });
        }

    }









    Open Case Details after Add Case


    Pages > Add Case > Add Script Adapter widget > make it hidden > edit wiring

    "Page Container " : "SendNewCaseInfo" > "Receive event payload"




    And, put the following code in it. 
    The script hook to the AFTERSAVE coordination topic, it will be executed after case is saved.






    /**
     * Created by tianxj on 2014/3/28.

     */

    console.log("Open new case begin");

    var self = this;

    self.caseEdt = payload.caseEditable;

    console.log(self.caseEdt);



    var coord = payload.coordination;



    require(["icm/base/Constants", "icm/util/Coordination"], function(Constants, Coordination){

        console.log("part to aftersave");

        console.log(Constants.CoordTopic.AFTERSAVE);

        console.log(coord);

        coord.participate(Constants.CoordTopic.AFTERSAVE, function(context, complete, abort){

            console.log("part call back");

            self.checkCount = 0;

            self.statusChecker = setInterval(function(){

                self.caseEdt.retrieveAttributes(function(){

                    self.checkCount++;

                    console.log("check case states");

                    console.log(self.checkCount);

                    var caseState = self.caseEdt.caseObject.attributes["CmAcmCaseState"];

                    console.log(caseState);

                    if(caseState == 2){

                        clearInterval(self.statusChecker);

                        delete self.statusChecker;

                        self.onBroadcastEvent("icm.OpenCase",{
                            "caseEditable": self.caseEdt,
                            "coordination": new Coordination()
                        });
                        console.log("Open the case");
                        setTimeout(complete,1000);
                    }

                    if(self.checkCount > 5){
                        console.log("Can't open the case");
                        clearInterval(self.statusChecker);
                        delete self.statusChecker;
                        abort({"message":"Case was created, but can't open it according to wrong case status"});
                    }
                });
            }, 1000);
        });
    });
    console.log("Open new case end");

    ============


    Open Work Task After Create a Case

    //"Page Container " : "SendNewCaseInfo" > "Receive event payload"


    var self = this;
    var coord = payload.coordination;

    require(["icm/base/Constants", "icm/util/Coordination"],
        function (Constants, Coordination) {

            console.log("Open new case begin");

            self.caseEdt = payload.caseEditable;

            var workListName = "Investigator";

            console.log("part to aftersave");
            console.log(Constants.CoordTopic.AFTERSAVE);
            console.log(coord);

            coord.participate(Constants.CoordTopic.AFTERSAVE, function (context, complete, abort) {

                debugger;
                //Entered Form Info
                console.log("part call back");
                self.checkCount = 0;
                self.caseCreatedFlag = false;
                self.statusChecker = setInterval(function () {

                    self.caseEdt.retrieveAttributes(function () {

                        self.checkCount++;
                        console.log("check case states");
                        console.log("checkCount :" + self.checkCount);
                        var caseState = self.caseEdt.caseObject.attributes["CmAcmCaseState"];

                        console.log("caseState : " + caseState);
                        //Working (2) // Completed (3)
                        if (caseState == 2 && !self.caseCreatedFlag) {

                            self.caseCreatedFlag = true;
                            clearInterval(self.statusChecker);
                            delete self.statusChecker;

                            var caseUniqueField = self.caseEdt.caseObject.attributes["CmAcmCaseIdentifier"];
                            subsVar = {
                                "substitution_vars": [{
                                    "name": "CmAcmCaseIdentifier",
                                    "value": [caseUniqueField],
                                    "type": "xs:string"
                                }]
                            };

                            
                            function retrieveAttributes(myItemFull) {
                                console.log("Inside Retrieve Attributes");
                                myEdit = myItemFull.createEditable();
                                payload = {};
                                payload.workItemEditable = myEdit;
                                payload.coordination = new icm.util.Coordination();
                                payload.UIState = new dojo.Stateful();
                                payload.openInNewTab = false;
                                broadcastResult = self.onBroadcastEvent(
                                    "icm.OpenWorkItem", payload);
                                console.log(broadcastResult);
                                setTimeout(complete, 1000);
                            }
                            var workitem;
                            function retrieveWorkItem(payload) {

                                console.log("Retrieve Work Item");
                                workitem = payload;
                                retrieveWorkItemFlag = false;
                                // Search for the specific workItem
                                console.log("Found " + workitem.fetchCount + " item(s) in the work basket");
                                for (var i = 0; i < workitem.fetchCount; i++) {
                                    retrieveWorkItemFlag = true;
                                    myItem = icm.model.WorkItem.fromWorkItem(workitem.getItem(i));
                                    myItem.lockStep(retrieveAttributes);
                                    //systemResponseDialogHelper.hideLoadingIndicator();
                                    return;
                                    
                                }
                                console.log("Could not find Step, Retrying in 1 second");
                                if (!retrieveWorkItemFlag) {
                                    setTimeout(function () {
                                        // Check here as well as this was not tested
                                        selectedWorkList.retrieveWorkItems(
                                            retrieveWorkItem, null,
                                            false, true, null,
                                            "(CmAcmCaseIdentifier=:A)",
                                            subsVar, null);
                                    }, 1000);
                                }
                            }

                            function retrieveWorkList(payload) {
                                console.log("Retrieve Work List");
                                debugger;
                                worklist = payload;
                                if (worklist != null) {
                                    for (var i = 0; i < worklist.length; i++) {
                                        debugger;
                                        console.log("Work List Name: " + worklist[i].auth_name);
                                        if (worklist[i].auth_name == workListName) {
                                            selectedWorkList = worklist[i];
                                            //systemResponseDialogHelper.showLoadingIndicator();
                                            selectedWorkList.retrieveWorkItems(
                                                retrieveWorkItem,
                                                null, false,
                                                true, null,
                                                "(CmAcmCaseIdentifier=:A)",
                                                subsVar, null);
                                            break;
                                        }
                                    }
                                    console.log("End of WorkList Search");
                                } else {
                                    console.warn("No Worklist Found");
                                }
                            }
                            self.getRole().retrieveWorklists(retrieveWorkList);
                        }



                        if (self.checkCount > 5 && !self.caseCreatedFlag) {

                            console.log("Can't open the case");

                            clearInterval(self.statusChecker);

                            delete self.statusChecker;

                            abort({ "message": "Case Created. Please close this tab and find the case in your in-basket." });

                        }

                    });

                }, 2500);


            });

        });

    console.log("Open new case end");





    Create custom in basket filter 
    to show only works that has property "PortEmployeeName" equal the current active user


    1) Configure script adapter wiring

    2) Configure In-basket to wait for custom filter

    3) Configure user Role to pass filter property

    add property PortEmployeeName to the role



    4) Script adapter code

    var caseFilterValue = ecm.model.desktop.userDisplayName; 
    var dataType = "xs:string";
    var solutionPrefix = ecm.model.desktop.currentSolution.prefix;
    var inbasketName = ecm.model.desktop.currentRole.name;
    var queueName = solutionPrefix + "_" + inbasketName.replace(/\s+/g, '');

    var json = {"queueName":queueName,
    "inbasketName":inbasketName,
    "hideFilterUI":true,
    "queryFilter":"("+solutionPrefix+"_PortEmployeeName = :A)",
    "queryFields": [{"name": solutionPrefix+"_PortEmployeeName", "value": caseFilterValue , "type": dataType}],
    "hideLockedByOther":"false"};

    var dynamicFilter = icm.model.InbasketDynamicFilter.fromJSON(json);
    var dynamicFilters = [];
    dynamicFilters.push(dynamicFilter);
    var applyFilters = {"dynamicFilters": dynamicFilters};
    return applyFilters; 


    =================



    How to get next Work item without showing the work items list?

    Pages > Work details







    How to access user information from an ICM page script?

    Using the current user id, name, or role is a great way to provide more user centric information to you case workers. In IBM Case Manager 5.2 and it new client side scripting model, here's how you get that information.

    Add a script adapter widget to the Cases solution page
    Wire its incoming event to a custom event action button added to the toolbar of one of the page widgets
    var userName = ecm.model.desktop.userDisplayName;
    var userId = ecm.model.desktop.userId;
    var role = ecm.model.desktop.currentRole.name;

    var messageDialog = new ecm.widget.dialog.MessageDialog({
        text: "<b>Role</b>: " + role + " - " + userName + " - " + userId
    });
    messageDialog.show();

    Get Next work item in custom page
    By default, you will see all the work item list and can choose anyone to process, 
    But custom service in bank or insurance company should not choose a favorite custom to service; they just service for any custom the system push to them.
    To achieve this, first, we need to hidden In-basket, which can be easily done by hidden default Work page.
    Open target solution, switch to Roles tab, click to open target role, then on Pages tab, remove Work page.


    var self = this;
    var role = ecm.model.desktop.currentRole;   /* self.role; */
    require(["icm/model/WorkItem","icm/util/WorkItemHandler"],function(WorkItem, WorkItemHandler)
    {
     role.retrieveWorklists(function(inbaskets)
     {
      if(inbaskets.length > 0)
      { 
    /*if there are multiple In-baskets*/
        var inbasket = inbaskets[0]; /*we choose the first one, this should be first role's In-basket*/
        inbasket.retrieveWorkItems(function(resultSet)
    {
         var items = resultSet.getItems();  
         /*fetch the work items in this In-basket*/
         if(resultSet.getItems().length >0)
    {  
    /*if there are multiple work items*/
    var first = resultSet.getItems()[0];  
    /*get the first one*/
    first = WorkItem.fromWorkItem(first);  
        debugger;
    /*this is to change an ICN work item to the format of ICM work item*/
    var workItemHandler = new WorkItemHandler(self);  
    /*open it*/
    workItemHandler.handleCurrentPageWorkItem(first);  
    /*process the next first work item*/                                 
    }
        });
      }
     });
    });


    =======
    Read cases from another solution

    Key points:
    icm/model/_DesktopMixin
    this.retrieveSolutions(function(solutionList) 

    ---------------------
    define(["dojo/_base/declare", 
    "dojo/_base/lang",
    "dojo/_base/array",
    "icm/base/Constants",
    "icm/model/Case",   
    "ecm/LoggerMixin",
    "icm/model/_DesktopMixin"], 
    function(declare, lang, array, Constants, Case, LoggerMixin, _DesktopMixin){
        return declare("icm.custom.pgwidget.customSearchWidget.CustomWidgetContentPaneEventListener", [LoggerMixin, _DesktopMixin], {
    
            searchTemplate: null,
            widget: null,
    
            constructor: function(widget){
                this.widget = widget;
            },
    
            buildPayload: function(values) {
                if(!values) {
                    console.log("An invalid values is received!");
                    return;
                }
    
                console.log("retrieveSolutions");
                var that = this;
                this.retrieveSolutions(function(solutionList) {
                    array.forEach(solutionList, function(solution) {
                        if (solution.id === "CBFPSFED_57_2") {
                            console.log("CBFPSFED_57_2");
    
                            var searchPayload = new icm.util.SearchPayload();
    
                            var params = {};
                            params.ObjectStore = solution.getTargetOS().id;
    
                            params.ceQuery = "SELECT t.[FolderName], t.[LastModifier], t.[DateLastModified], t.[CmAcmCaseTypeFolder], t.[CmAcmCaseState], t.[CmAcmCaseIdentifier], t.[DateCreated], t.[Creator], t.[Id], t.[ContainerType], t.[LockToken], t.[LockTimeout],  t.[ClassDescription], t.[DateLastModified], t.[FolderName] FROM [CmAcmCaseFolder] t where ";
                            params.ceQuery += "t.[CmAcmCaseIdentifier] LIKE '%%'  AND t.[JR572_name] LIKE '%%%'";
    
                            solution.retrieveCaseTypes(function(types) {
                                console.log(types);             
                                console.log(params.ceQuery);
                                params.caseType = types && types.length > 0 && types[0].name; // default to the first case type
                                params.solution = solution;
    
                                searchPayload.setModel(params);
                                var payload = searchPayload.getSearchPayload(function(payload) {
                                    that.widget.onBroadcastEvent("icm.SearchCases", payload);
                                    console.log("buildPayload");
                                    console.log(payload);
                                });
                            });
                        }
                    });
                });
            },
    
            _eoc_: null
        });
    });





    ======
    How do I programmatically start a discretionary task from a toolbar button?




    var caseEditable = this.getActionContext("Case")[0];
    var solution = caseEditable.caseObject.caseType.getSolution();
    var prefix = solution.getPrefix();
    var theCaseID = caseEditable.getCaseTitle();
    
    /* Modify this line to match the internal name of a task in your solution */
    var taskType = prefix + "_MeetingRequest";
    
    callback=function(taskEditable){
    
    /* Modify this line to set the task name that appears in the Task List. It can be anything you want  */
         taskEditable.setTaskName("Meeting Re: " + theCaseID);
    
         var addTaskPagePayload = {
              "taskEditable": taskEditable,
              "coordination": new icm.util.Coordination()
         };
         this.broadcastEvent("icm.AddTask", addTaskPagePayload);
    };
    caseEditable.caseObject.createNewTaskEditable(taskType, dojo.hitch(this,callback));













    Custom Dropdown List 

    • Wire a Script Adaptor to the icm.SendNewTaskInfo event from container.
    var theProp = this.solution.getPrefix() +"_CaseStage";
    
    console.log("Registering choice function");
    
    /* For the add task payload, the workItemEditable is returned by the getLaunchStep method */
    
    var workItemEdt = payload.taskEditable.getLaunchStep();
    var coord = payload.coordination;
    
    var choices = [{
        label: "Triaging",
        value: "1"
    }, {
        label: "Processing",
        value: "2"
    }, {
        label: "Finalizing",
        value: "3"
    }];
    
    require(["icm/model/properties/controller/ControllerManager", "icm/base/Constants"],function(ControllerManager, Constants){
        coord.participate(Constants.CoordTopic.LOADWIDGET, function(context, complete, abort){
            var propsController = ControllerManager.bind(workItemEdt);
            var propController = propsController.getPropertyController(theProp);
            if (propController){
                propController.set("choices", choices);
            }
            else
                console.log("ERROR - No such property: " + theProp);        
            complete();
        });
    
       /* Use the AFTERLOADWIDGET coordination topic handler to release the controller binding for the editable. */
       /* Since the prop controller can be shared, doing this in the AFTERLOADWIDGET ensures no other widget overrides your changes. */
       coord.participate(Constants.CoordTopic.AFTERLOADWIDGET, function(context, complete, abort) {
          /* Release the controller binding for the editable. */
          ControllerManager.unbind(editable);
    
          /* Call the coordination completion method. */
          complete();
       });
    
    });






    ======
    for more information visit ECM Community Blog


    http://ecmibm.blogspot.com/2016/09/dynamic-web-application-development.html