How to call Business Service or Workflow from PM script in Siebel Open UI
15. 2. 2019
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";
})
}
Back to Blog