To set restrictions

Restrictions are similar to bindings in that they establish selection criteria for the method where they are defined. Their intention, however, is slightly different so they are slightly less flexible than the bindings described in To set bindings.

Restrictions are applied before bindings to limit the set of records that can be considered for selection.

Restrictions are always tested against parameter values (not against dynamic, URL-submitted values).

Restrictions are always evaluated using an "equals" operator to check field values (via their attribute mappings) against some specific parameter value.

  1. Double-click on the target method to open the properties window for that attribute.
  2. Select Method Attributes.
  3. Select Restrictions...
  4. Click Add.
  5. Select an attribute from the Attribute drop-down list. The restriction will apply to values returned for this attribute.
  6. Select a value from the Value drop-down list. Only records having this value for the selected attribute will be permitted by the restriction. The drop-down list shows all of the parameters currently configured for the method. If the parameter you need is not listed, select <Add Parameter ...> to open the Parameters window.
  7. If you want to limit the conditions under which the restriction is applied, select a boolean parameter from the Condition drop-down list. The restriction will apply only when this condition evaluates to true.

    For example: a method returning previous orders usually limits the orders returned to those placed by the current user. However, when a manager from a given customer company logs in, he or she should be able to see back orders from all users from his or her company. In this case, the condition would be set up to return a value of "false" when the current user has the "Customer Manager" role. However, an additional restriction would ensure that only orders from users at the manager's own company were returned.

  8. If your method is able both to update existing records and to create new records, then you should decide whether or not the restriction should apply when creating or if it should only apply when updating. To remove the restriction when creating records, select false on the Not to create list. To apply the restriction when creating, select True.
  9. Click OK.

To remove a restriction, in the Restrictions window, select the target entry and click on the Delete button.

To change a restriction's settings, select the target restriction entry in the Restrictions window. That entry's current settings then load into the controls at the top of the window. Use the controls as described in the procedure above to make changes and then click OK to apply your new settings.