BPM, Workflow, and Case

BPM, Workflow, and Case

Come for answers. Stay for best practices. All we’re missing is you.

 View Only
  • 1.  Instances migration from old snapshot to a new snapshot

    Posted Tue July 25, 2023 05:10 AM

    Hello,

    We have a lot of instances and want to migrate only failed instances to the new snapshot and do the re-try. 

    Is it possible to migrate just a few instances from an old snapshot to a new one? Or is it not possible and all instances must be moved from the old snapshot to the new snapshot?

    Version 21.0.3 of IBAW



    ------------------------------
    Donata Mielaikaite
    ------------------------------


  • 2.  RE: Instances migration from old snapshot to a new snapshot

    Posted Wed July 26, 2023 08:26 AM

    Yes, you can migrate specific instances using the JS API - migrateWithContextTo(TWProcessAppSnapshot snapshot)

    Migrates an instance and its context to the specified snapshot.

    Documentation: https://www.ibm.com/docs/en/baw/19.x?topic=apis-javascript-api-in-processes-service-flows

    So, you can use JS API to migrate just specific a single or multiple instances from snapshotA to snapshotB.

    var twProcessApp = tw.system.model.processApp;
    var twSS = twProcessApp.findSnapshotByName("Sanpshot name") ;
    tw.system.currentProcessInstance.migrateWithContextTo(twSS);

    Another example -

    var instance = tw.system.findProcessInstanceByID(20449);
    var snapshot = tw.system.model.findProcessAppByAcronym("IZT").findSnapshotByName("1.0.6.3");
    instance.migrateWithContextTo(snapshot);



    ------------------------------
    Sergei Malynovskyi
    ------------------------------



  • 3.  RE: Instances migration from old snapshot to a new snapshot

    Posted Wed July 26, 2023 01:51 PM

    Hello Donata,

    You can create a Process for migrating your process instances. This solution every time customizable and manageable...

    Migrate Instance: 

    var instance = tw.system.findProcessInstanceByID(tw.local.instanceList[tw.local.counter]);
    var snapshot = tw.system.model.processApp.findSnapshotByID(tw.local.targetSnapshotId);
    instance.migrateWithContextTo(snapshot);
    
    log.info("Migrate Instance Process - InstanceId: " + tw.local.instanceList[tw.local.counter] + " migrated to " + tw.system.model.processAppSnapshot.acronym);
    tw.local.counter++;

    for using this process you can design a human services for UI or you can call Start Process method in REST Api

    .../rest/bpm/wle/v1/process?action=start&bpdId=123&snapshotId=123&branchId=123&processAppId=123&parts=all



    ------------------------------
    MEHMET SELİM ARLI
    ------------------------------