How to read not visible field in the Presentation Model of Open UI
How to read not visible field in the Presentation Model of Open UI
There is often a need to read in the Presentation Model of Open UI (PM) not exposed Business Component fields. There is a limitation of the PM , that only in the applet exposed fields can be read.We have 2 options how to read these not exposed fields.
- Create a Business Service, which on the server side will do the query on the fields and returns them to the caller PM script. This approach consumes a lot of resources and creates a traffic for each query.
- Our little trick which we want to describe more in detail.
High Level :
- Create new developer workspace
- In this workspace configure the BC Fields which you want to read as a controls, with
- Field Type : BC Field
- HTML Type : Hidden

- In the Siebel Webtools, under Applet -> Applet Web Template, choose appropriate template and click Preview button

- Add the new control to the button area.

- Checkpoint and deliver the workspace
- Create your PM script for reading your fields. Here is some example : The important part is
var BC=this.Get("GetBusComp"); //get the needed params var sMOBIProfile=BC.GetFieldValue("MOBI Profile");
here is the full Presentation Model javascript example :
//CCW 2020 Martin Piekov
//13.01.2020 Martin Piekov
//this is to calculate url based on profile for drilldown
if (typeof(SiebelAppFacade.AssetMgmtAssetAttachmentListAppletPM) === "undefined") {
SiebelJS.Namespace("SiebelAppFacade.AssetMgmtAssetAttachmentListAppletPM");
define("siebel/custom/AssetMgmtAssetAttachmentListAppletPM", ["siebel/listpmodel"],
function () {
SiebelAppFacade.AssetMgmtAssetAttachmentListAppletPM = (function () {
function AssetMgmtAssetAttachmentListAppletPM(pm) {
SiebelAppFacade.AssetMgmtAssetAttachmentListAppletPM.superclass.constructor.apply(this, arguments);
}
SiebelJS.Extend(AssetMgmtAssetAttachmentListAppletPM, SiebelAppFacade.ListPresentationModel);
AssetMgmtAssetAttachmentListAppletPM.prototype.Init = function () {
// Init is called each time the object is initialised.
// Add code here that should happen before default processing
SiebelAppFacade.AssetMgmtAssetAttachmentListAppletPM.superclass.Init.apply(this, arguments);
// Add code here that should happen after default processing
this.AddMethod( "InvokeMethod", PreInvokeProcess, { sequence : true, scope : this } ); //pre handler
}
AssetMgmtAssetAttachmentListAppletPM.prototype.Setup = function (propSet) {
// Setup is called each time the object is initialised.
// Add code here that should happen before default processing
SiebelAppFacade.AssetMgmtAssetAttachmentListAppletPM.superclass.Setup.apply(this, arguments);
// Add code here that should happen after default processing
}
function PreInvokeProcess( methodName, psInputArgs, lp, returnStructure)
{
if( methodName === "Drilldown"){
var sURL="";
var BC=this.Get("GetBusComp");
//get the needed params
var sMOBIProfile=BC.GetFieldValue("MOBI Profile");
var sDocId = BC.GetFieldValue("MOBI Document Id");
if ((sDocId.length < 1)&&(sMOBIProfile.length<1))
returnStructure ["ContinueOperation"] = true;
else {
switch (sMOBIProfile) {
case "IAA_FREMDVERTRAG" :
var sURLPrefix = SiebelApp.S_App.GetProfileAttr("ecmGGURL");
sURL = sURLPrefix + sDocId+"/profiles/SiebelB2C/formats/original/disposition/inline";
break;
default:
break;
}
if (sURL.length > 0) {
var win = window.open(sURL, '_new');
returnStructure ["CancelOperation"] = true;
}
};
}
returnStructure ["ContinueOperation"] = true;
}
return AssetMgmtAssetAttachmentListAppletPM;
}()
);
return "SiebelAppFacade.AssetMgmtAssetAttachmentListAppletPM";
})
}