How to invoke business service in Siebel Open UI?

Well, when all the dust settles and novelty wears off we all have to get back to work and write code to accomplish business requirement. Open UI only changes the way you would write scripts but you still have to do it. So, without wasting much time here is the how you would invoke a Siebel Business Service on click of a button from Open UI.


You have button on an Applet that invokes a method name “Submit”. Invoke a business service to run validation on the current record.


I am not including required PR and PM code to make it work. Just the working code required to call business service.The first step is to add the Invoke method handler in PM

InvokeMethod in PM

//When invoke method happens call Validate function
//sequence: true – invoke the Open UI code first
this.AddMethod( "InvokeMethod", Validate, { sequence : true, scope : this } );

Function Validate

function Validate(methodName, psInputArgs, lp, returnStructure){
//usual if or switch to handle different methods
if(methodName == "Submit"){
//define a new propertyset and set appropriate input arguments
var inPS = SiebelApp.S_App.NewPropertySet();
var service = SiebelApp.S_App.GetService( "Validate Data" ); //get service
if( service ){
var outPS = service.InvokeMethod( "Validate", inPS); //invoke the method
//on success we get a property set with type result set
var resultSet = outPS.GetChildByType("ResultSet");
//let assume we get a string as output
var errmsg = resultSet.GetProperty("errormsg");
if(errmsg != "")
this.SetProperty("requiredFields",errmsg); //this will be attached in PR to trigger UI behvior
SiebelApp.S_App.uiStatus.Free(); //to remove the wait icon
returnStructure ["CancelOperation"] = true;  //return cancel operation so nothing on Server side is invoked
}//end of function ValidateSR

In Siebel PR


Show error function will define what you would like to do on UI for example highlight the labels or show a dialog box.

Business Service Registration:

The last step is to register this and Client business service in Application User Property.

Name: ClientBusinessService10 (Number would vary based on your application)

Value: Validate Data

This is the step that necessitates creation a proxy business service so that you don’t have to do this for every business service that you are trying to invoke. Discussion of  Proxy Business Service is out of scope of this post and needs a post on its own. So, let’s leave that for a later time.

Do, let me know what else would you like me to post about.

5 Responses to How to invoke business service in Siebel Open UI?

  1. Hi Neel,

    may I express my concerns about using an applet button as the example for invoking a server side business service in Open UI…

    It is my greatest fear that people start writing browser side script code to implement stuff that doesn’t belong to the browser side.

    Buttons and menu items still work the same way as ever – Open UI or not – , you have the choice of using the Named Method user property or Runtime Events or even Server Script to invoke the business service.

    But please keep posting on Open UI. Thanks for educating people on the next generation UI for Siebel CRM.

    have a nice day


    • @lex I agree, this might not be the best example for how to of a business service from browser script. I will update the post with a note.

      I am planning a post around this topic as I cannot express my thoughts fully through comments. I wish there was a way to have an interactive session.

  2. Hi Guys,

    I am trying to invoke BS from PR/PM in asynch mode.
    Requirement is to display charts, so I am using Siebel BS to populate data in charts . As of now I have implemented using synch call as posted above and it is working fine. But as it takes time sometimes and we do not want to block UI from rendering, charts should be displayed when Siebel BS returns results.

    I have found below code on Bookshelf for invoking BS in asynch mode. As per this code when BS call completes, callback function will be called. But in my case, I will also need output of BS in callback method. Not able to find a way to do the same.
    Any help will be appreciated

    var service = SiebelApp.S_App.GetService(“business_service_name”);
    if (service) {
    var inPropSet = CCFMiscUtil_CreatePropSet();
    //Code occurs here that sets the inPropSet property set with all information that Siebel Open UI must send as input to the method that it calls.
    var ai = {};
    ai.async = true;
    ai.selfbusy = true;
    ai.scope = this;
    ai.mask = true;
    ai.opdecode = true;
    ai.errcb = function(){
    //Code occurs here for the method that Siebel Open UI runs if the AJAX call fails
    ai.cb = function(){
    //Code occurs here for the method that Siebel Open UI runs if the AJAX call is successful
    service.InvokeMethod(“method_name”, “input_arguments”, ai);

  3. Hi Neel,
    very nice and helpful article. I am facing a difficulty though in getting the output from the BS in PM.
    I am trying to return a hierarchical property set. When i log the output in the console, all i get is a string like this “PropertySet [ array ]”. here, array is the output argument of the method with storage type set as hierarchy and i’ve set the type of ouput property set to this “array”. Can you please help me how can i get the desired output.
    Moreover, when i try to get output with the following line, i always get null.
    var resultSet = outPS.GetChildByType(“ResultSet”);

  4. Hi

    My requirement is to invoke an Applet level server script on click of button from the Dashboard Applet.
    Currently there are two dashboard js files, I have tried extending these two files by adding custom files.
    But I am still not able to call the Applet level script.
    Please help.
    Below code mentions the PM and PR js files. Please let me know if this its proper shape. I am new to openUI and trying out various options.

    if( typeof( SiebelAppFacade.CallCodePM ) === “undefined” )
    SiebelJS.Namespace( “SiebelAppFacade.CallCodePM” );

    /* Register constructor with OpenUI application agains the key name */
    SiebelApp.S_App.RegisterConstructorAgainstKey( “CallCodePM”, “SiebelAppFacade.CallCodePM” );

    SiebelAppFacade.CallCodePM =
    ( function()
    var consts = SiebelJS.Dependency( “SiebelApp.Constants” );

    function CallCodePM()
    SiebelAppFacade.CallCodePM.superclass.constructor.apply( this, arguments );

    /* By default, any List Applet in OpenUI gets initialized with DashboardPresentationModel object.
    * We want to enhance on top of it and hence must extend from DashboardPresentationModel to keep
    * the core functionality.

    SiebelJS.Extend( CallCodePM, SiebelAppFacade.DashboardPresentationModel );

    CallCodePM.prototype.Init =
    function(){ this );

    /* PM’s specific event which is being used to restore any record which was deleted and still present in local cache*/
    this.AttachEventHandler( “CALLCODE”, OnClickCallCode );

    /* Attach Handler when writerecord has completed at server-side and
    client’s core framework is yet to process the response */
    this.AttachPreProxyExecuteBinding( “WriteRecord”, function(methodName, inputPS, outputPS){
    // Empty Implementation as of now!

    /* Attach Handler when writerecord processing has completed at server-side and
    client’s core framework has also finished processing the response */
    this.AttachPostProxyExecuteBinding( “WriteRecord”, PostWriteRecord);

    function OnClickCallCode (){

    this.ExecuteMethod( “InvokeMethod”, “CallCode”, null, false );


    return CallCodePM;

    if( typeof( SiebelAppFacade.CallCodePR ) === “undefined” ){

    SiebelJS.Namespace( “SiebelAppFacade.CallCodePR” );

    /* Register the constructor with OpenUI application agains the key name */
    SiebelApp.S_App.RegisterConstructorAgainstKey( “CallCodePR”, “SiebelAppFacade.CallCodePR” );

    SiebelAppFacade.CallCodePR = ( function(){

    var siebConsts = SiebelJS.Dependency( “SiebelApp.Constants” );

    /* *
    * Constructor Function – CallCodePR
    * Parameter – presentation model ref
    * */
    function CallCodePR( pm ){
    /* Be a good citizen. Let Superclass constructor function gets executed first */ this, pm );


    SiebelJS.Extend( CallCodePR, SiebelAppFacade.DashboardPhyRenderer );

    CallCodePR.prototype.ShowUI = function(){ this );
    /* Now, list has shown in UI. Let’s show carousel */


    CallCodePR.prototype.BindEvents = function(){ this );

    /* Attach Events for Carousel Items whenever they appear in Applet Region */
    $( “#207” )

    “button.siebui-dashboard-callcode”, “click”, {ctx : this}, callcode );

    CallCodePR.prototype.BindData = function(){
    SiebelAppFacade.CallCodePR.superclass.BindData.apply( this, arguments );

    function callcode( evt ){
    var pm =;
    pm.OnControlEvent( “CALLCODE”);

    return CallCodePR;

Leave a Reply