Sunday, 30 August 2015

Component - Under Cover Agent




                                Under Cover Agent         


Invoking UCA can create new instance of process. In general, UCA's are associated to external services. Creation of new instance through UCA provide lots of flexibility.

Consume Message - If it is checked, then subsequent process will not be able to pick message. In case of unchecked all successive processes will be able to create new instance.

Durable Subscription - In normal process, token will wait for message. As soon as, message will reach at token. It will create process instance.

But what if, message has been send and token has not been reached at implementation. In that case if durable subscription is checked, token will not wait at implementation. It will directly execute.



Thursday, 27 August 2015

Coach View - Button click will return it's label name along with alert message


  Button click will return it's label name along with alert message 

  A - Copy button component and create new coach view
  B - Click on variable tab and change business data type from Boolean to String.
  C - Define variable in configuration option
              message (String)
  D - Click on Behavior tab -- Remove previous code exists in event handler's view

  Paste given below code in view


var baseTextDirection = this.context.options._metadata.baseTextDirection && this.context.options._metadata.baseTextDirection.get("value") ? this.context.options._metadata.baseTextDirection.get("value") : utilities.BiDi.BASE_TEXT_DIRECTION._default;
var generalPrefTextDirection = this.context.bpm.system.baseTextDirection;
var button = this.context.element.getElementsByTagName("button")[0];
var visibility = utilities.handleVisibility(this.context, null, null, [button]);
if (visibility != "NONE") {
// if (this.context.options._metadata.label && this.context.options._metadata.label.get("value") != "") {
//  button.innerHTML = this.context.htmlEscape(this.context.options._metadata.label.get("value"));
//  utilities.BiDi.applyTextDir(button, button.innerHTML, baseTextDirection, generalPrefTextDirection);
// } else {
//  // In Firefox a button with no text or " " shows very small, using a non-breaking space prevents this
//  button.innerHTML = " ";
// }
    //button.innerHTML = this.context.options.buttonName.get("value");
    button.innerHTML = this.context.htmlEscape(this.context.options._metadata.label.get("value"));
//  utilities.BiDi.applyTextDir(button, button.innerHTML, baseTextDirection, generalPrefTextDirection);
    
// if (this.context.options._metadata.helpText && this.context.options._metadata.helpText.get("value") != "") {
//  button.title = this.context.options._metadata.helpText.get("value");
// }
 button.onmousedown = function() {
  domClass.add(this, "BPMButton-down");
 };
 button.onmouseout = button.onmouseup = function() {
  domClass.remove(this, "BPMButton-down");
 };
 var _this = this;
 button.onclick = function() {
  if (this.disabled == false) {
   var context = _this.context;
   var message = context.options.message.get("value");
  
   if (context.options.allowMultipleClicks == undefined || !context.options.allowMultipleClicks.get("value")) {
    this.disabled = true;
    domClass.add(this, "BPMButton-disabled");
   }
   if (context.binding) {
    context.binding.set("value", button.innerHTML);
   }
   var _button = this;           
            var response=confirm(message); 
   if(response == true) {
       context.trigger(function() {_button.disabled = false; domClass.remove(_button, "BPMButton-disabled");});
   }
   else {
       this.disabled = false;
    domClass.remove(this, "BPMButton-disabled");
//       _button.disabled = false
//       domClass.remove(_button, "BPMButton-disabled");
       return; //context.trigger();
   }
  }
 }
 this.updateStyle();
};

 E - Coach view is ready with label name. Drag and Drop in Human Service.
 F - Bind it with string variable.


TWX File ---



Wednesday, 26 August 2015

Coach View - Display error message at Table's Component row level



Display error message at Table's Component row level -

To achieve :
  


Validation Code : (Text Box)


for(var iCount=0; iCount<tw.local.testBO.listLength-1; iCount++){
      if(tw.local.testBO[iCount].userName == null || tw.local.testBO[iCount].userName == "" ){
         var componentName = "tw.local.testBO[" + iCount + "].userName";
         tw.system.addCoachValidationError(tw.system.coachValidation, componentName, "Please provide user details...");
    }                                                   
}    


Validation Code : (Combo Box)

For combo box, it could not be achieved with binding because binding is having list.  It can be done through selected item.

Configuration -- Selected Item -- Assign a Name Value Pair variable. Suppose variable name is "userNameNV".


for(var iCount=0; iCount<tw.local.testBO.listLength-1; iCount++){

      if(tw.local.testBO[iCount].userNameNV == null ||
                                tw.local.testBO[iCount].userNameNV == "" ){
         var componentName = "tw.local.testBO[" + iCount + "].userNameNV";
         tw.system.addCoachValidationError(tw.system.coachValidation,
                                                                  componentName, "Please provide user details...");
    }                                                   
}    



--------------------------
----------End------------
--------------------------