Friday 1 April 2016

Snippet to Get 'All' PM properties for an Applet

If you have been working Open UI, you must have come across 'Get' method in PM. Now, the Get method will have different properties for different types of applet. The list varies for Form Applet to List applet. Also, you can add more properties in your custom code. If you want to see what properties are available, you can use my code snippet below.

1. Click on the applet you want to see the properties. (this sets the applet as active applet)
2. Go to F12 window, click on Sources tab. Go to Snippets sub tab. Create a snippet by right clicking and select New.




3. In the window, add below code.


var pModel = SiebelApp.S_App.GetActiveView().GetActiveApplet().GetPModel();
var PArray = SiebelApp.S_App.GetActiveView().GetActiveApplet().GetPropArray();
var tablecol1 = new Array();
var tablecol2 = new Array();
for (var i=0;i< PArray.length;i++){
    tablecol1.push(PArray[i]);
    tablecol2.push(pModel.Get(PArray[i]));
}
var tableArr = new Array();
for (var i=0;i < PArray.length;i++){
    tableArr.push([tablecol1[i],tablecol2[i]]);
}
console.table(tableArr);



4. Right click on the snippet source and select Run. Check your Console Tab and see all the properties available.


If you see values like Array[5], Object or an , they are actually Javascript objects or Arrays that you can inspect further. In the console, you can expand the Array at the end and check the properties.



Alternatively, you can check each property by typing in tableArr[index] where index is the number in first column.

Example is given below.

You just need to add this code once. It will be available in all other windows. All you need to do is set your applet as active applet (click anywhere on applet) and run the snippet!!

Let me know if you find this useful ;)