License verification

Civic Platform provides the ability to validate license, insurance, or other information against data at an external database by using a web service. For example, you can configure an EMSE script to validate the user license number and the expiration date against the license information stored at the state government office during the application process. You can also configure scripts to run the validation script in accordance to an event in the software, such as clicking the login button. When validations fail, an error message displays to the public user. See Figure 114: OnLoginBefore Failed Validation Error Message and Figure 115: Error Message during Record Creation on page 439.

Citizen Access can capture license information in multiple areas within Citizen Access. So, you must configure the EMSE scripts to run in various places throughout Citizen Access for a complete and thorough implementation. The content of the EMSE scripts vary depending on which area of Citizen Access you are writing; however, each EMSE script contains the universal ValidateLicense script. The ValidateLicense script provides the code to call the external web service and exchange the packaged information about validation.

This section provides you with configurations for a complete implementation of this feature. It includes a complete listing the various areas of Citizen Access that incorporate licenses and provides the key components for validation setup in each area. Key components include EMSE templates, events, parameters, and the ValidateLicense script requirements to ensure proper functionality.

Begin configuration of this feature by writing the universal ValidateLicense script. Ensure you collect the web service information that you need to effectively communicate with the external database. This may include the parameters for license number or for expiration date from Civic Platform and the external data source.

For complete instructions on EMSE Events and Scripts, see the “Event Manager and Script Engine” chapter and the “Writing Scripts” chapter in the Accela Civic Platform Scripting Guide.

Configure the license script to call the web service

The ValidateLicense script contains the definitions to call the web service and exchange data in packets. Ensure you collect the web service information that you need to effectively communicate with the external database before writing the universal ValidateLicense script. This may include the parameters for license number or for expiration date from Civic Platform and the external data source. Each EMSE script that is used throughout Citizen Access to verify license information must contain this ValidateLicense script or the validation simply does not work. Write, customize, and apply the following function for EMSE scripts associated with license validation. Follow the script template as described below.

Script template of function ValidateLicense (licenseNumber, licenseType)

{

var client=aa.httpClient;

var url="https://www4.cbs.state.or.us/ex/fred/permits/simplecall.cfc";

client.addParameter("method","lic_ok");

client.addParameter("returnformat","json");

client.addParameter("p_lic_num",licenseType);

var resultString=String(client.post(url).getOutput());

//Convert to jsonObject

var result=eval("("+resultString+")");

}