Updates to allow using custom type values in 'type' field (for example, to support legacy data)

There are some updates for using CrM within legacy data where changing of 'type' field values isn't allowed but having correct type casting is required.