Friday, August 7, 2015

Visibility Inside Coach View

For Coach View components we don't have custom visibility.

 In side Coach visibility options

Inside Coach View visibility options

If we want to add custom visibility inside coach view we don't have default options we have to customize the coach view.

Example Scenario

          we have select and text CV inside coach view. based on selected value we need to show or hide the text coach view.

               

Solution:

1.Get the Vertical Section sub-view inside the change event handler.


                              var n1 = this.context.getSubview("Vertical_Section1", true)[0];
2.Get the selected value of select box and compare with your value.if Selected value is yes the shoe the text CV else Hide the CV.
Write the below code in both view and change.when loading and changing the select box this script will apply.

                var n1 = this.context.getSubview("Vertical_Section1", true)[0];

                  if(this.context.options.seletedItem.get("value").get("name")=="YES")
                 {
                         var n2 = n1.context.getSubview("Text1", true)[0];
                         n2.context.setDisplay(true);
                        n2.context.options._metadata.visibility.set("value","DEFAULT");
                  }
                 if(this.context.options.seletedItem.get("value").get("name")=="NO")
                 {
                         var n2 = n1.context.getSubview("Text1", true)[0];
                         n2.context.setDisplay(false);
                  }



Results:

1. When we select Yes we are showing the text CV.
2.When we select No we are hiding the text CV.



Hope this is useful....................
                 

Wednesday, August 5, 2015

Active Instance List

If you want to get the all the active instances for the specified process application.

this TWSearch will return all the active instances.


var col1 = new TWSearchColumn();
col1.name = TWSearchColumn.ProcessInstanceColumns.ID;
col1.type = TWSearchColumn.Types.ProcessInstance;

var condition = new TWSearchCondition();
condition.column = new TWSearchColumn();
condition.column.name = TWSearchColumn.ProcessInstanceColumns.Status;
condition.column.type = TWSearchColumn.Types.ProcessInstance;
condition.operator = TWSearchCondition.Operations.Equals;
condition.value = "Active";


var condition2 = new TWSearchCondition();
condition2.column = new TWSearchColumn();
condition2.column.name = TWSearchColumn.ProcessColumns.Name;
condition2.column.type = TWSearchColumn.Types.Process;
condition2.operator = TWSearchCondition.Operations.Equals;
condition2.value = "Test";


var search = new TWSearch();
search.columns = [col1];

search.conditions = [condition, condition2];
var order1 = new TWSearchOrdering();
order1.column = col1;
order1.order = TWSearchOrdering.Orders.Descending;
search.orderBy = new Array(order1);
search.organizedBy = TWSearch.OrganizeByTypes.ProcessInstance;
var results = search.execute();
   
var instaceID[];
 for(var i=0;i<results.rows.length;i++)
        {
                  instaceID[] =  results.rows[i].values[0];

     }