Configuring Siebel Open UI > Customizing Siebel Open UI for Siebel Mobile Disconnected > Doing General Customization Tasks for Siebel Mobile Disconnected >

Configuring Error Messages for Disconnected Clients


This topic describes how to configure Siebel Open UI to use the SetErrorMsg method in your custom code to return and display a custom error message in a disconnected client.

To configure error messages for disconnected clients

  1. Use an editor to open the file that calls a custom applet, business component, or business service.

    This is the same file that you create in Using Siebel Business Services or JavaScript Services to Customize Siebel CRM Objects.

  2. Locate the code that might return an error message.

    For example, assume your deployment includes the following code, and that this code calls a method that might return an error message:

    BusComp.prototype.Caller = function ()
      this.Called();
      $.callback(this,function(retObj){

    In this example, the Called method might return an error message. It calls the Caller method. These methods might reside in different locations in a production environment.

  3. Add the following code to the code that you located in Step 2:

        //Check for any errors
        if(retObj.err){
          $.setReturnValue(retObj);
        }
        else{
          //Positive case
          $.setReturnValue({err:false,retVal:false});
        }
      });
      return;
    }

    This code determines whether or not the Called method returns an error message. If it:

    • Returns an error message, then this code calls the setReturnValue method.
    • Does not return an error message, then the following code sets the err return value to null:

    $.setReturnValue({err:false,retVal :false});

    For information see setReturnValue Method.

  4. Add the following code to the code that you located in Step 3:

    BusComp.prototype.Called = function (){
      var errParamArray = [];
      errParamArray.push(value1, valueN);
    SiebelApp.S_App.OfflineErrorObject.SetErrorMsg("messageKey", errParamArray);
    $.setReturnValue({err:"AppropriateErrorCode",retVal:false});

    where:

    • value1 is a property that Siebel Open UI sends to the SetErrorMsg method. You can configure Siebel Open UI to send up to eight properties.
    • messageKey is a key that Siebel Open UI maps to the message string that it displays.

      For more information, see SetErrorMsg Method.

      In this example, the following code calls the SetErrorMsg method:

    SiebelApp.S_App.OfflineErrorObject.SetErrorMsg("AppropriateErrorCode", errParamArray);

    The following code makes sure Siebel Open UI returns an err value. This value contains the error code:

    $.setReturnValue({err:"AppropriateErrorCode",retVal:false});
    return;

The following code is the completed code that this example uses:

BusComp.prototype.Caller = function ()
  this.Called();
  $.callback(this,function(retObj){
    //Check for any erros
    if(retObj.err){
      $.setReturnValue(retObj);
    }
    else{
      //Positive case
      $.setReturnValue({err:false,retVal :false});
    }
  });
  return;
}
BusComp.prototype.Called = function (){
  var errParamArray = [];
  errParamArray.push(fieldName);
  SiebelApp.S_App.OfflineErrorObject.SetErrorMsg("ErrorCode",   errParamArray);
  $.setReturnValue({err:"AppropriateErrorCode",retVal:false});
  return;
}

where:

  • ErrorCode identifies a messageKey. Siebel Open UI gets the message text for the message key from the swemessages_language_code.js file that resides in an local folder. For example, swemessages_enu.js. For more information about the language_code, see Languages That Siebel Open UI Supports.
  • fieldName identifies the name of a business component field. This field contains the values that Siebel Open UI displays in the error message. For example, the predefined BCErrNoSuchField message key includes the following message text in the swemessages_enu.js file:

    "Field '%1' not found in BusComp."

    SetErrorMsg replaces %1 with the value that Siebel Open UI passes in the errParamArray. For example:

    errParamArray.push("Name");
    SiebelApp.S_App.OfflineErrorObject.SetErrorMsg("BCErrNoSuchField",errParamArray)

    In this example, Siebel Open UI replaces "%1" with the value Name:

    "Field 'Name' not found in BusComp."

Configuring Siebel Open UI Copyright © 2015, Oracle and/or its affiliates. All rights reserved. Legal Notices.