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 the call from button : function PreInvokeMethod(methodName, psInputArgs, lp, returnStructure) { 

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

5. To CancelOperation , here is the trick , use : 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";
})
}
 

Before we begin: take a look at the processing of your personal data

If you visit a site that records cookies, a small text file will be created on your computer and stored in your browser. The next time you visit the same page, it will help you connect to the web faster. Our website will offer you relevant information and make it easier for you to work.

We mainly use cookies for anonymous traffic analysis and to improve our website. If you set your browser to block cookies, it is possible that the website will slow down and some parts of the website may not work completely correctly. More info on the processing of cookies.