Siebel Tools > How to invoke Business Service with input and output parameters
How to invoke Business Service with input and output parameters
Add this function to BC Server Script. This is written in Siebel eScript
BServiceName : name of Business Service mName : name of the method to invoke params : parameters (syntaxe : "nameParam1=[Field Name],nameParam2='Value') function f_InvokeBS(BServiceName,mName,params) {
try{ var svc,Inputs,Outputs,propName,propValue; svc = TheApplication().GetService(BServiceName); Inputs = TheApplication().NewPropertySet(); Outputs = TheApplication().NewPropertySet(); if(params){ var paramsArray=params.split(","); for(var i=0;i<paramsArray.length;i++){ var paramArray=paramsArray[i].split("="); if(paramArray.length!=2) throw "The Parameter number "+(i+1)+" is wrong"; propName=paramArray[0].replace(/^\s+|\s+$/g,''); // trim propValue=paramArray[1].replace(/^\s+|\s+$/g,''); // trim if(propName=="") throw "The name of Parameter number"+(i+1)+" is empty"; if(propValue.match("^\\[.+\\]$")){ // [Field Name] propValue=propValue.substr(1,propValue.length-2); Inputs.SetProperty(propName,this.GetFieldValue(propValue)); } else if(propValue.match("^'.*'$")){ // 'Value' propValue=propValue.substr(1,propValue.length-2); Inputs.SetProperty(propName,propValue); } else throw "The value of parameter "+propName+" is false"; } } // Invoke svc.InvokeMethod(mName, Inputs, Outputs) return Outputs; }catch(e){ throw (e); } finally{ // Clean Inputs=null; Outputs=null; } }
Call the BS
f_InvokeBS("SLM Save List Service","LoadPopupApplet","Applet Name='"+appletName+"',Applet Mode='"+mode+"'");
or
f_InvokeBS("Workflow Process Manager","RunProcess","Object Id=[Id],ProcessName='Workflow Name'")
|