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.

  1. Create a new Entity
    1. Name = Log
    2. Plural Name = Logs
    3. Ownership = Organization
    4. Schema Name = philipri_log
    5. Notes = No
    6. Activities = No
    7. Show in Settings = Yes
    8. Primary Attribute - This will store a description of the CRUD action (eg. Create).
      1. Display Name = Action
      2. Schema Name = philipri_Action
      3. Requirement Level = No Constraint
  2. Add Attribute - This will store the integer referring to the Entity.
    1. Display Name = EntityTypeCode
    2. Schema Name = philipri_entitytypecode
    3. Requirement Level = No Constraint
    4. Type = Int
    5. Format = None
    6. Minimum Value = 0
    7. Maximum Value = 2,147,483,647
  3. Add Attribute - This will be the GUID of the actual record on which the action is being performed
    1. Display Name = RecordId
    2. Schema Name = philipri_recordid
    3. Requirement Level = No Constraint
    4. Type = nvarchar   
    5. Format = text
    1. Maximum Length = 50
  4. Then go an strip all the fields off the form. You want to make it hard for people to create 'phony log records'.
  5. 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: