User Self Registration Example

User Self Registration

The goal of the User Self Registration business process is to make it possible for users to create their own user profile in Websydian Express.

The business process is installed with the demo site and can be accessed using the Register menu item in the top menu.

Please note that the Register menu item is only shown when you are not logged into the site.

Overview

Overview of The User Self Registration business process.

The example contains two pages, a registration page containing a "Submit Registration" button and a Success Page shown after a successful update:

  1. On the first page (Registration Page), the user should enter information necessary to create a user profile.
  2. When the "Submit Registration" button is pressed, the entered values are validated.
  3. If any errors are found, the Registration Page will be shown again, with a message describing the error.
  4. If the validation is successful, the user profile is created and the Success Page informing the user that the profile is created is shown. In this example we have shown a case, where it is necessary to extend the Websydian Express User entity. The file WICUSTPF contains this extension. This means that when a user is created, two things happen:
    1. A User is created in Websydian Express
    2. A record containing the extension data is created in WICUSTPF

The main points of the example:

The source code for the program objects can be found in the WXUSSESRC source file in the library chosen as the runtime library during the installation (default WXP11PGM/WXP12PGM).

Flow

1. Start Business Process

The Business Process starts when you press the menu item assigned to the business process. This is registered by the runtime and the runtime calls the ProcessEntryPoint WICUSTREG.

This function just calls the Customer Registration PageGenerator WXCUSTRPG.

The PageGenerator sets the values that should be shown on the web page - and uses these values and the Template WICUSTREG to generate the final web page that is sent to the web browser.

 

2. User Enters Data

The user enters data on the Customer Registration Page and presses the "Register" button.

 

3. Handle Register Event

The runtime receives the request from the browser - and calls the Register EventHandler WICUSTREGE.

This program retrieves the values entered by the user and validates the data.

If the validation fails, the PageGenerator WXCUSTRPG is called again, with the information about the error.

If the validation is successful, the Websydian Express user is created and a record is added to the extension table (WICUSTPF).

After creating the user and the extension record, the Show Success PageGenerator WXCUSTSPG is called.

The PageGenerator sets the values that should be shown on the web page - and uses these values and the Template WXSUCCESS to generate the final web page that is sent to the web browser.

 

Detailed Program Description

The following section describes each of the programs used in the example in detail.

ProcessEntryPoint WICUSTREG

The Customer Registration ProcessEntryPoint WICUSTREG is the program called by the Websydian Express runtime when the User Self Registration business process is activated from the menu.

The name of the ProcessEntryPoint must correspond to the process ID defined for the process (see the documentation for Process Maintenance in the administration interface).

Interrface:

As for all ProcessEntryPoints, this function must have an interface with one parameter (a 7 character return code).

Functionality:

The Customer Registration ProcessEntryPoint just calls the PageGenerator WXCUSTRPG.

 

PageGenerator WXCUSTRPG

The Customer Registration Pagegenerator is called as the first page in the business process and it is called when the data entered by the user is invalid.

Interface:

The interface consists of an error message field - and of a datastructure containing all of the input fields from the Register Event. The error message is used to transfer information about errors occuring during validation (or creation of records) from the EventHandler to the PageGenerator. The datastructure is used to transfer all of the entered data for the Register event to the PageGenerator in error situations - this makes it possible for the PageGenerator to fill the input fields with the data entered by the user - so the user does not need to reenter all of the data in error situations.

Functionality:

The PageGenerator performs three basic steps:

1. Set Output values

2. Set initial values for input fields

3. Write Page to Browser

 

PageGenerator WXCUSTSPG

The Registration Successful PageGenerator is called when the registration of a user has been performed successfully.

Interface:

The interface consists of a datastructure containing all the input fields from the Customer Registration Event. This makes it possible to show name, e-mail etc. on the page as part of the success message.

Functionality

1. Set Output values

2. Write Page to browser

 

EventHandler WICUSTREGE

The Register EventHandler is called when the Register button on the Customer Registration Page is pressed.

Interface:

As for all EventHandlers, the interface consists of two fields: A 7 character return code field and a one character Action Field.

Functionality:

1. Handle Event Registration

2. Retrieve User Input

3. Business Logic

4. Call PageGenerator

 

Template Descriptions

HTML template: Registration Page WICUSTREG

This HTML template is used to generate the Registration Page. The Registration Page is the initial page in the User Self Registration business process, where the user can enter the information needed in order for the business process to create a user profile.

For more information on how HTML templates are used to generate HTML pages please read HTML Templates and Replacement Markers.

HTML template: Success Page WISUCCESS

This HTML template is used to generate the Success Page which will be displayed when a user successfully has created a user profile.

For more information on how HTML templates are used to generate HTML pages please read HTML Templates and Replacement Markers.

 

Recap

The example shows the handling of a simple, but quite common situation: A user needs to enter some data, that must be validated and updated in a database, and the user must be informed about the result of the transaction.

The main things to notice are: