Fields Visibility

You can change the visibility of the various fields (value of $readonly) and other variables in the different modes (ListView, EditView, and so on) via SDK. To register a new "view" use the method:

SDK::addView($module, $src, $mode, $success);

$module : the name of the module to apply the view
$src : the path of php file
$mode : how the rule is applied (see below)
$success: what to do after applying the rule (see below)

The views defined for each module are applied in the order in which they are registered. When they register, they are added to the queue of views for that module. The $mode variable only makes sense if you change the $readonly variable and it admits the following values:

“constrain” : forces the value of $readonly to take the new value given in the script
“restrict” : changes the value of $readonly only for a more restrictive value (from 1 to 99 or 100, from 99 to 100, not vice versa)

The $success variable instead can be:

“continue” : after applying the view, continue with the next
“stop” : if the view returns $success = true, no other rules are executed

The following variables are available within the scripts:

$sdk_mode : one of “” (create), “edit”, “detail”, “popup_query”, “list_related_query”, “popup”, “related”, “list”, “mass_edit”
$readonly : the readonly value for the current field (1, 99, 100)
$col_fields: values of fields, only for $sdk_mode = “edit”, “detail” e “”
$fieldname or $fieldName: the name of the current field
$current_user: the current user

And you can set the $success variable with true or false.
Depending on the mode (ListView, EditView, and so on) there are different ways to edit the queries and different variables available.

Mode Value of $sdk_mode Available variables Notes
CreateView "" $col_fields
$current_user
$fieldname
$readonly
$success
1
EditView "edit"  
DetailView "detail"  
MassEdit "mass_edit"  
PopupQuery "popup_query" $sdk_columns
$success
2
List/RelatedQuery "list_related_query" $sdk_columns
$success
 
Popup "popup" $current_user
$fieldname
$sdk_columnnames
$sdk_columnvalues
$readonly
$success
3
Related "related" 4
List "list"  

Notes:

  1. In these modes the values of the fields are in $col_fields[nameOfTheField]
  2. These modes are used to modify the query so that additional fields can be picked up. In $sdk_columns variable there are the database columns to add to the query. Include then the php file “modules/SDK/AddColumnsToQueryView.php”
  3. To get values from other fields, specified in the PopupQuery and ListRelatedQuery modes, write them in the $sdk_columnnames variable, include the php file “modules/SDK/GetFieldsFromQueryView.php” and then take them from $sdk_columnvalues
  4. In the case of the related "Activity history", only the variables $recordId and $readonly are available and apply to the entire row, not to the single field.

To remove the view:

SDK::deleteView($module, $src);

$module : the name of the module
$src : the path of php file

Hooks
include/ListView/ListViewController.php
include/utils/DetailViewUtils.php
include/utils/EditViewUtils.php
include/utils/ListViewUtils.php
include/QueryGenerator/QueryGenerator.php
Popup.php

Back to top