0

我正在尝试在打开案例时预览类似的 IBM Case manager 案例,我收到错误 onBroadcastEvent is not a function it is not included inside self. 我正在使用连接到脚本适配器(发送工作项)

require(["icm/model/properties/controller/ControllerManager", "ecm/model/Desktop" ], function(ControllerManager, Desktop) {

  var solution = Desktop.currentSolution;   
  var params = {};  
  var self = this;    

  var prefix = solution.prefix;    

  params.ObjectStore = solution.getTargetOS().id;    

  var custID = payload.workItemEditable.propertiesCollection.LSS_IdentificationValue.value;

  console.log ("Customer ID: ",custID);    

  var caseObj = payload.workItemEditable.icmWorkItem.caseObject;    

  caseObj.retrieveCachedAttributes(function(caseObject) {      

  var caseID = caseObject.caseIdentifier;      

  console.log ("Case ID: ",caseID);        

  /* Find all of these */      

  var criterion1 = new ecm.model.SearchCriterion({"id": prefix+"IdentificationValue", "name" : "Identification Type", "selectedOperator": "STARTSWITH", "defaultOperator": "STARTSWITH", "dataType": "xs:string"});      

  criterion1.value = custID ;      

  criterion1.defaultValue = custID ;      

  criterion1.setValues( [custID]);        

  params.criterions = [criterion1];      

  params.CaseType = ""; /* all case types */      

  params.solution = solution;        

  var searchPayload = new icm.util.SearchPayload();      
  searchPayload.setModel(params);        
  searchPayload.getSearchPayload(function(payload) {          
  self.onBroadcastEvent("icm.SearchCases", payload);      
  });  

  });            
});
4

1 回答 1

0

“var self = this;”中的“this” 驻留在匿名函数中,因此这可能是 Window 对象。

我是否正确理解此代码块位于脚本适配器中?在这种情况下,请将您的作业移到第一行,在您的要求之前。然后你自己将使用脚本适配器(上面有 onBroadcastEvent 功能)。

  var self = this; 
  require(["icm/model/properties/controller/ControllerManager", "ecm/model/Desktop" ], function(ControllerManager, Desktop) {

  var solution = Desktop.currentSolution;   
  var params = {};
  ....
于 2021-08-26T10:00:11.113 回答