Sunday, 12 April 2015

JavaScript for Dynamic in-basket Filter (Case Manager Scipt)

//JavaScript for Dynamic in-basket Filter based on role and In-basket. 

Script: 

var um = parent.com.ibm.mashups.enabler.model.Factory.getUserModel();                                                        
var dfr = um.findCurrentUser();                                                         
var currentUserObj = dfr.start();                                                        
var currUser = currentUserObj.getDisplayName();                                         
var currRole =  ecmwdgt.getBean("spaceConfig").getEffectiveRole();                
fmsCurrInbasket = payload.currentInbasket ;
console.log('currUser = '+currUser+"  currRole="+currRole + "  Inbasket="+payload.currentInbasket);

if (currRole=='Employee' && payload.currentInbasket=='My Work')
 {
 console.log("inside Requestor if loop "); 
    console.log("Current User" + currUser);
 var filter= {                    
    "queueName":payload.queueName,                    
    "inbasketName":payload.currentInbasket,                    
    "hideFilterUI":false,                    
    "filters":[                               
  {                    
   "name": "EmpID",                    
   "value":currUser                     
  },     
  {                    
     "name": "Pointer",                    
     "value":'2'                     
  }
    ]                    
 };                    
    console.log("inside loop: " +filter);               
    return filter;
 }
 
return payload;
   
Wiring:

 



No comments:

Post a Comment