blog image

How to call Business Service or Workflow from PM script in Siebel Open UI

There is plenty documentation how to call business service or workflow from Siebel Open UI PM or PR script. In old siebel the call was as simple as from browser java script. There are undocumented workarounds to make it work in Siebel Open UI.

There are needed  few steps :

1. Generate PM script for your applet for example from https://duncanford.github.io/prpm-code-generator/?prpm=PM&object=DesktopList&name=BeautifulThing&userprops=&comments=Yes&logging=No

2. Insert the listener in the superclass.Init.apply method: this.AddMethod("InvokeMethod", PreInvokeMethod,{sequence : true,scope: this});    }

3. Insert the code which implements the call of BS or Workflow , where methodName is call from button erc.: function PreInvokeMethod(methodName, psInputArgs, lp, returnStructure) { 

4. To  retrieve the result use : var psResult = psOut.GetChildByType("ResultSet"); 

5. To CancelOperation use , the second command is the trick: returnStructure ["CancelOperation"] = true; SiebelApp.S_App.uiStatus.Free();

  Full code of the PM script for the Access Controlled Business Service List Applet is here :

//---------------------------------------------------
//CCW s.r.o. www.ccw.sk 
//----------------------------------------------------
if (typeof(SiebelAppFacade.AccessControlledBusinessServiceListAppletPM) === "undefined") {
SiebelJS.Namespace("SiebelAppFacade.AccessControlledBusinessServiceListAppletPM");
define("siebel/custom/AccessControlledBusinessServiceListAppletPM", ["siebel/listpmodel"],
  function () {
   SiebelAppFacade.AccessControlledBusinessServiceListAppletPM = (function () {
    function AccessControlledBusinessServiceListAppletPM(pm) {
     SiebelAppFacade.AccessControlledBusinessServiceListAppletPM.superclass.constructor.apply(this, arguments);
    }
    SiebelJS.Extend(AccessControlledBusinessServiceListAppletPM, SiebelAppFacade.ListPresentationModel);
    AccessControlledBusinessServiceListAppletPM.prototype.Init = function () {
     // Init is called each time the object is initialised.
     // Add code here that should happen before default processing
     SiebelAppFacade.AccessControlledBusinessServiceListAppletPM.superclass.Init.apply(this, arguments);
     //SiebelJS.Log(this.Get("GetName")+": AccessControlledBusinessServiceListAppletPM:      Init method reached.");
     // Add code here that should happen after default processing
                this.AddMethod("InvokeMethod", PreInvokeMethod,{sequence : true, scope: this});
    }
    AccessControlledBusinessServiceListAppletPM.prototype.Setup = function (propSet) {
     // Setup is called each time the object is initialised.
     // Add code here that should happen before default processing
     //SiebelJS.Log(this.Get("GetName")+": AccessControlledBusinessServiceListAppletPM:      Setup method reached.");
     SiebelAppFacade.AccessControlledBusinessServiceListAppletPM.superclass.Setup.apply(this, arguments);
     // Add code here that should happen after default processing
    }
                
function PreInvokeMethod(methodName, psInputArgs, lp, returnStructure) {               
     if ( methodName === "Export" ) {                         
                                var oBC=this.Get("GetBusComp");
                               var sId=oBC.GetFieldValue("Id");
                               var bsWFPrcMgr = SiebelApp.S_App.GetService("Workflow Process Manager");
                               var oPSIn = SiebelApp.S_App.NewPropertySet();
                               oPSIn.SetProperty("ProcessName","Local Deployment Export General");
                               oPSIn.SetProperty("Entity",oBC.GetName());
                               oPSIn.SetProperty("Object Id",sId);
                               var psOut = bsWFPrcMgr.InvokeMethod("RunProcess",oPSIn);
                               var psResult = psOut.GetChildByType("ResultSet");                           
                               oPSIn = null;
                               bsWFPrcMgr = null;                       
                               returnStructure ["CancelOperation"] = true;
                               SiebelApp.S_App.uiStatus.Free();
     }
                returnStructure ["ContinueOperation"] = true;
    }
                
    return AccessControlledBusinessServiceListAppletPM;
   }()
  );
  return "SiebelAppFacade.AccessControlledBusinessServiceListAppletPM";
})
}
 

Skôr ako začneme: nahliadnite do spracovania vašich osobných údajov

Ak navštívite stránku, ktorá zapisuje cookies, v počítači sa vám vytvorí malý textový súbor, ktorý sa uloží vo vašom prehliadači. Ak rovnakú stránku navštívite nabudúce, pripojíte sa vďaka nemu na web rýchlejšie. Náš web vám ponúkne relevantné informácie a bude sa vám pracovať jednoduchšie.

Súbory cookies používame najmä na anonymnú analýzu návštevnosti a vylepšovanie našich web stránok. Ak si nastavíte blokovanie zápisu cookies do vášho prehliadača, je možné, že web sa spomalí a niektoré jeho časti nemusia fungovať úplne korektne. Viac info k spracúvaniu cookies.