An account action is a mechanism to suggest an action to perform within an account.
An account action is represented by a node which represents the type of account action and optionally a set of parameters, known as the account action parameters. These are passed as a single string, but can, for example, contain JSON.
The account action node provides:
- A method to describe the action.
- An Account template field that indicates what account template should be used to create a new account for the account action, if the user needs one. If not set, the Default account template property from the theme will be used if available. If this is also unavailable, the defaultAccountTemplate dynamic binding from the account action will be used.
- A method to initialise the action.
The account action node must be owned by and accessible to the account authority. It should have a script (using the standard Script method), and should accept an action parameter. It must support two actions, each of which is passed the account action parameters in the params parameter.
- display – return in the content element HTML that describes the account action, to allow the user to decide whether or not to do it. Alternatively, return in the redirect element a page to which the user should be directed. If a redirect is used, the account action is effectively cancelled.
- init – initialise the account action. Using either content or redirect, show the user what to do next.
Account Action provides a suitable type for creating account actions. In this, the display and init actions are coded as two separate scripts, which are called by a stub which looks at the action parameter. The scripts are run under the authority of the account authority. The scripts are passed two parametrs: "params", which contains the account action parameters, and "userLogonReferenceCurrent" which contains the user logon reference of the current user. In an init script, this can be used with the UserProperty service to set the Home action to force the current user to take an action.
Account actions are processed within the standard UI. Control is passed to start.jsp, passing the account action and parameters in the parameters accountAction and accountActionParameters. If the user is not signed in or signed up, then the account action and its parameters are passed through the relevant screens until the user is signed up. Once signed up, the presence of the account action redirects the user to account_action.jsp, using the Home action user property.
account_action.jsp is passed an account action node and parameters. It runs the account action node with the display action, and displays the description of the account action. It allows the user to accept or cancel. Like theme install, it uses a session variable to prevent the action being run automatically.
account_action_accept.jsp is invoked if the user accepts the account action. This runs the account action, with an action of init, and passing it the parameters, and then shows the content or actions the redirect that is returned.
If required, the account action may write to the Home action member of the user's property node. This will cause Metrici to constantly return to the action until it is removed (either by deleting it, or by redirecting to home.jsp with a removeAction=true parameter). The user can remove the home action by signing out.
Account actions may be used to install a product. In this case, the Home action will redirect to a node that guides the user through subscription, installation and possibly running an action on a product. However, the account action is independent of product install.
An account action node does not have to do anything, in which case the account action acts simply as a method for account creation.
Using an account action for product install
You can use Account Action to create an account action for product install.
Inherit from Product Install Account Action Prototype, which sets the display and init action scripts. Set the description to the confirmation text you want to show the user and set the account template. Set the product binding on the scripts page to the installer for the product.