blog image

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 :

  1. Create new developer workspace
  2. In this workspace configure the BC Fields which you want to read as a controls, with 
    • Field Type : BC Field
    • HTML Type : Hidden hiddencontrols
  3. In the Siebel Webtools, under Applet -> Applet Web Template, choose appropriate template and click Preview button webtoolslayout
  4. Add the new control to the button area. weblayouthidden
  5. Checkpoint and deliver the workspace
  6. 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";
 })
}

Before we begin: take a look at the processing of your personal data

If you visit a site that records cookies, a small text file will be created on your computer and stored in your browser. The next time you visit the same page, it will help you connect to the web faster. Our website will offer you relevant information and make it easier for you to work.

We mainly use cookies for anonymous traffic analysis and to improve our website. If you set your browser to block cookies, it is possible that the website will slow down and some parts of the website may not work completely correctly. More info on the processing of cookies.