Adding a database view into the SalesLogix web architecture can be a tricky process, due mostly to the fussiness of NHibernate. What follows is a step-by-step guide to help you through the process.

Problems at the end of the process can be avoided by following these rules when designing your view.

  1. The view name cannot start with the letter I.
  2. The view name and fields must be capitalized.
  3. The view fields must not have spaces in them.
  4. The view key field must be of type char(12). You can accomplish this with a simple Cast or Convert SQL function (in MS SQL Server).

IMPORTANT: If the key field does not have a database type or char(12) you will get the error "Year, Month, and Day parameters describe an un-representable DateTime" at runtime.

Once your view is working the way you want, the next step is to enable it in DB Manager.

  1. Open the Architect or Administrator tool and launch DB Manager.
  2. Right click on your view and select Properties.
  3. Click the “Enable” button, and click OK.
  4. Right click on the key field of your enabled view and select properties.
  5. Verify that the “Field Type” box reads “SLX Standard ID”.

I have seen situations where the view's key field is not populated in the RESYNCTABLEDEFS table. This can be easily checked with the query:

select * from ResyncTableDefs where TableName = ‘my view name’

If it is missing, then simply add it with the query:

Update ResyncTableDefs set KeyField = ‘my key field name’ where TableName = ‘my view name’

We are now ready to add our view as an entity.

The process is the same as adding any other table from the database. Note that any relationships that you create from an entity based on a database view should have the Cascade property set to "None" or "Not Applicable" since the underlying database view cannot be directly changed.

Posted in:

Start a Project With Us

Submit your email below to get in touch with our team.