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
- 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.
- 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 ()
var currRetValue={err:false}, retObj;
retObj=currRetValue=this.Called();
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.
- Add the following code to the code that you located in Step 2:
//Check for any errors
if(retObj.err){
currRetValue=retObj;
}
else{
//Positive case
currRetValue={err:false,retVal:false};
}
});
return currRetValue;
}
This code determines whether or not the Called method returns an error message. If it:
- Returns an error message, then this code calls the return value to some error.
- Does not return an error message, then the following code sets the err return value to null:
currRetValue={err:false,retVal :false};
- Add the following code to the code that you located in Step 3:
BusComp.prototype.Called = function (){
var currRetValue={err:false}, retObj;
var errParamArray = [];
errParamArray.push(value1, valueN);
SiebelApp.S_App.OfflineErrorObject.SetErrorMsg("messageKey", errParamArray);
currRetValue={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:
currRetValue = {err:"AppropriateErrorCode",retVal:false};
return currRetValue;
The following code is the completed code that this example uses: BusComp.prototype.Caller = function ()
var currRetValue={err:false}, retObj;
retObj=currRetValue=this.Called();
//Check for any errors
if(retObj.err){
currRetValue=(retObj);
}
else{
//Positive case
currRetValue={err:false,retVal :false};
}
return currRetValue;
}
BusComp.prototype.Called = function (){
var currRetValue={err:false}, retObj;
var errParamArray = [];
errParamArray.push(fieldName);
SiebelApp.S_App.OfflineErrorObject.SetErrorMsg("ErrorCode", errParamArray);
currRetValue={err:"AppropriateErrorCode",retVal:false};
return currRetValue;
}
where:
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."
|