cdtj

Custom WebEngine OP : Who is currently watching object

Blog Post created by cdtj Champion on Jul 29, 2015

Here is one more example how custom webengine operations could be used.

 

    How this looks

active_session.png

    How this works

 

Each time we open an object (request, chage order, issue, contact or anything else) session will be created,

closing object causes session remove.

 

 

    Technique

 

1. We need new table to store sessions:

Table z_viewers:

attributes:

    cnt SREL cnt;

    obj_id STRING(32); // I'm using string to store objects persids to make universal field which can't be done by using SREL.

 

2. Add events to create/remove session to objects:

In example I'm using cr (Request) factory, so we need to open detail_cr.htmpl.

Set onload and onunload events:

     <body class="detailro" onload="loadActions();setViewer(0);" onunload="unloadActions();setViewer(1);">

define JavaScript function:

function setViewer(action){
  var url = cfgCgi +
  "?SID=" + cfgSID +
  "+FID=" + fid_generator() +
  "+OP=Z_SET_VIEWER" +
  "+FACTORY=cr" +
  "+CALLBACK=null" +
  "+PERSID=" + argPersistentID +
  "+REMOVE=" + action +
  "+POPUP_NAME=" + '$args.KEEP.POPUP_NAME' +
  "+VIEWER=" + "$cst.id";
  display_new_page(url, ahdtop.workframe); // *
}



* - we are loading OP to ahdtop, because onunload haven't enought time to load in popup before it closes.

 

3. Code Z_SET_VIEWER:

Entire code is attached as attachment.

 

 

     Conclusion

 

Here is one more "extreme" customization, hope this will help someone to understand SPEL coding logics.

Attachments

Outcomes