Personify Data Services – User-Friendly Message for Validation Issues

As of 7.4.2, the Personify APIs support more user-friendly validation issue messages to end users, particularly end users who are interacting with Personify from the web via our .NET controls. This section is intended to describe this new feature that has been added to the Personify APIs.

 

New functionality has been introduced within the Personify APIs, and more specifically within the validation issue base classes of the Personify APIs, to allow developers to create more user-friendly messages when a validation issue occurs.

To enable the use of these new friendly validation issues:

1.    Start Visual Studio and create a new class library.

2.    Name the class library project Personify.Validation.FriendlyMessages, as shown below.
friendly_name.png

3.    Add a new resource file to the project. Name this new resource file FriendlyMessages, as shown below.
resource_file.png

4.    Open the newly created resource file and add the fully qualified name space and class name as the name of the first resource, as shown below.
assembly_name.png
Example:
TIMSS.API.Base.CustomerInfo.UpdateJobTitleOnAddressesIssue becomes TIMSS_API_Base_CustomerInfo_UpdateJobTitleOnAddressesIssue.

Note.pngResource file names cannot contain a period "." character. Please replace each period in the name space and/or class name with an underscore "_". For example: TIMSS.API.Base.CustomerInfo.UpdateJobTitleOnAddressesIssue becomes TIMSS_API_Base_CustomerInfo_UpdateJobTitleOnAddressesIssue.

5.    In the Value column, enter your own user-friendly message that will be returned when the validation issue is raised, as shown below.
VS.png

6.    Build your resource assembly.

7.    Place your resource assembly in the same folder where the Personify APIs are located.
At runtime, the core validation issue classes will check for the existence of your resource assembly, and if it is found, the core validation issue class will load the friendly message from your assembly and return it with the particular validation issue being raised.

 

We can always get all technical/user-friendly messages of Exceptions/ValidationIssues in the form of XML using “ex.InnerException.Message” from SvcClient during a call to “Save” service operation.  The original message is still available for backward compatibility (should not have any breaking changes).

 

Once the dll is copied to “bin” folder of PDS, the PDS framework automatically picks it up, extracts the user-friendly validation issue messages and will send the same to consumer in the form of XML.

image1.jpg

 

In order to create exceptions based on user defined messages, in Service Operations, we can do something like the following:

image2.jpg

instead of:

image3.jpg

 

You can check for sample code in service operations “CreateIndividual”, “UpdateIndividual” and “GetMembershipOrderPreview” released by base.

 

In order to display user friendly messages in web controls, we can code something like the following:

image4.jpg

 

More sample code is available in the following Personify Web Controls:

·            MyAccountContactAddress

·            RegistrationControl

·            MembershipBuyBoxControl

·            ContactInformationEmail

·            CustomerAddress

·            UserNamePasswordControl

·            EmergencyContact