An error message may be displayed when attempting to access an SDATA resource. The error message refers to a null pointer exception when calling the processCustomView method in CustomDataResource.


The erorr message may appear when accessing the Sage CRM SDATA schema, or when attempting to access a specific resource. The following will be displayed:

 at com.sage.crm.sdata.classes.CustomDataResource.processCustomView(
 at com.sage.crm.sdata.classes.CustomDataResource.<init>(
 at com.sage.crm.sdata.endpoint.SDataSchemaEndpoint.processAllResources(
 at com.sage.crm.sdata.endpoint.SDataSchemaEndpoint.handleMessage(
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at com.sage.crm.web.filters.ClearCurrentThreadLocalsFilter.doFilter(
 at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
 at java.util.concurrent.ThreadPoolExecutor$ Source)
 at Source)


The issue is caused by a custom view that does not reference a valid Sage CRM entity. On accessing an SDATA resource, a lookup is made from the Custom_Views table against the referenced entities on the Custom_Tables table. This is done using a foreign key on the Custom_Views table (CuVi_CustomTableIDFK) which points to Bord_TableId on the Custom_Tables table.

Typically this error is encountered following an upgrade - the view's CuVi_CustomTableIDFK entry on the Custom_Views table will reference the _undefined placeholder entity. These views can be identified by running the following SQL:

select CuVi_ViewID, CuVi_ViewName, CuVi_Entity, CuVi_CustomTableIDFK
from Custom_Views
where CuVi_CustomTableIDFK not in (
    select Bord_TableId
    from Custom_Tables
    where bord_name not like '_undefined%')


A backup should be carried out before attempting the following:

  1. Delete the problem entry from the Custom_Views table.
  2. Drop the problem view from the database.
  3. Refresh the Sage CRM views metadata.