1

On Can Execute

From Resco's Wiki
(Redirected from OnCanExecute)
Jump to navigation Jump to search
Rules and examples

On Can Execute button.png App users can execute commands from their app, for example, run a mobile report or delete several records at once. Predefined commands usually function out of the box. However, you can use rules to define their availability and tweak their function. On Can Execute defines when is a command available in the app. This rule is executed when a command is about to be displayed. Use it to control in which situations users can see and use the command, so that you can hide this command in situation, when its action is not suitable. On Can Execute controls availability of both predefined commands and custom commands.

On Can Execute is available for the following user interface components:

In Woodford, you can edit the commands available for a form. In Questionnaire Designer, you can edit the commands available when filling out a questionnaire.

Commands

List of predefined form and questionnaire commands can be found here.

Examples of On Can Execute rule

Field clearing command availability

If the Entity.addres1_line1 field contains data, delete clearing button is enabled. Otherwise, it remains disabled.

If Condition Command.Name Equals custom_del_street
Then If Condition Entity.addres1_line1 ContainsData
Then Step Command.isEnabled Assign True
Else Then Step Command.isEnabled Assign False

Disable Update GPS command

Users should not change the GPS position of a record, that already has the GPS position set. If the Entity.address1_longitude and Entity.address1_latitude fields contain data, UpdateGPS comand is disabled. Otherwise, it remains enabled.

If Condition Command.Name Equals UpdateGPS
Then If Condition Entity.address1_latitude ContainsData
and Condition Entity.address1_longitude ContainsData
Then Step Command.isEnabled Assign False
Else Then Step Command.isEnabled Assign True

Disable Delete command

You can add the Delete command but hide it in specific situations. If the current user is not an owner of specific record, the delete button is disabled for him. Otherwise, it remains enabled.

If Condition Command.Name Equals Delete
Then If Condition Entity.ownerid Does Not Equal Current User
Then Step Command.isEnabled Assign False
Else Then Step Command.isEnabled Assign True

Disable signature on Note attachment

You can disable the Signature option on Note’s Attachment.

If Condition Command.Name Equals DocAction.CaptureInk
Then Step Command.isEnabled Assign False

The tricky part can be setting the command’s name. It needs to be exactly DocAction.CaptureInk (Beware, it’s case sensitive!).




Was this information helpful? How can we improve?