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";
 })
}

Skôr ako začneme: nahliadnite do spracovania vašich osobných údajov

Ak navštívite stránku, ktorá zapisuje cookies, v počítači sa vám vytvorí malý textový súbor, ktorý sa uloží vo vašom prehliadači. Ak rovnakú stránku navštívite nabudúce, pripojíte sa vďaka nemu na web rýchlejšie. Náš web vám ponúkne relevantné informácie a bude sa vám pracovať jednoduchšie.

Súbory cookies používame najmä na anonymnú analýzu návštevnosti a vylepšovanie našich web stránok. Ak si nastavíte blokovanie zápisu cookies do vášho prehliadača, je možné, že web sa spomalí a niektoré jeho časti nemusia fungovať úplne korektne. Viac info k spracúvaniu cookies.