Building the CRM Logging Entity is trivial - however we need to think through
how the solution will actually perform the logging. The callout can call the web
service using the user's credentials or with an administrative set. The Form
however must call the webservice using the user's credentials. Therefore we will
need to give regular users Create privileges on this entity. We can prevent them
from deleting logs - but they will be able to create false logs.
I want this entity to be able to log data from any entity in the system so I
won't build any hardcoded relationships. I'll use the entity type code (which I
can get from the callout and the form) and store IDs with nvarchars.
- Create a new Entity
- Name = Log
- Plural Name = Logs
- Ownership = Organization
- Schema Name = philipri_log
- Notes = No
- Activities = No
- Show in Settings = Yes
- Primary Attribute - This will store a description of the CRUD action
(eg. Create).
- Display Name = Action
- Schema Name = philipri_Action
- Requirement Level = No Constraint
- Add Attribute - This will store the integer referring to the Entity.
- Display Name = EntityTypeCode
- Schema Name = philipri_entitytypecode
- Requirement Level = No Constraint
- Type = Int
- Format = None
- Minimum Value = 0
- Maximum Value = 2,147,483,647
- Add Attribute - This will be the GUID of the actual record on which the
action is being performed
- Display Name = RecordId
- Schema Name = philipri_recordid
- Requirement Level = No Constraint
- Type = nvarchar
- Format = text
- Maximum Length = 50
- Then go an strip all the fields off the form. You want to make it hard
for people to create 'phony log records'.
- Create some nice practical views. As you can see we use the Created By
and Created On attributes to show which user performed the action.

OK so now we have a nice tidy entity to store the Log data. We can access
this entity with our strongly typed web service, export to excel, write reports
off it etc.
Next: In Part 4 we will create the CRM callout to write data to
the log entity.
This posting is provided "AS IS" with no warranties, and confers no rights.
Tags: microsoft crm dynamics crm microsoft crm