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

7 comments:

  1. This is very useful. Thank you and god bless you.

    ReplyDelete
  2. Hi,

    I have a requirement to point a cursor to a specific record in Open UI. Invoked a business service from PR to get the record row id, but not sure how to place the cursor on the specific record. could you pls suggest.

    Thanks,

    ReplyDelete
    Replies
    1. Hi,

      Similar to Server scripts, you have to invoke next record. Run a code like this after getting the rowId from BS.

      if(rowId != this.GetPM().Get("GetBusComp").GetFieldValue("Id"))
      this.GetPM().ExecuteMethod("InvokeMethod","NextRecord")

      Delete
    2. Hi,

      Thanks for the suggestions.
      Shall i add this line in PR file itself or do I have to do it in PM.

      Delete
  3. Hi there. I found your web site by the use of Google even as searching for a similar matter, your web site came up. It appears to be good. I’ve bookmarked it in my google bookmarks to come back then.
    seo web design company

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
  5. This post is very simple to read and appreciate without leaving any details out. Great work ! call center solutions in Nigeria

    ReplyDelete