Tuesday, February 14, 2012

Dynamics CRM– Listing javascript used by forms

The javascript used in forms is stored in the table “OrganizationUIBase” in the CRM database for your organization [Organization_MSCRM].

Here is a quick query to list the entities and the script that is being used (the script is stored in FormXML field):

SELECT [Name] as EntityName
      ,[PhysicalName] as EntityPhysicalName
      ,[FormXml]
  FROM [Organization_MSCRM].[dbo].[OrganizationUIBase] o
  Join [Organization_MSCRM].[MetadataSchema].[Entity] e ON e.ObjectTypeCode = o.ObjectTypeCode
  where o.version = (SELECT max(oi.Version)
  FROM [Organization_MSCRM].[dbo].[OrganizationUIBase] oi
  WHERE oi.FormId = o.FormId)
  and o.formXml like '%<event%active="true">%'
 

The scripts finds those scripts that have been set to active. The script itself appears within the Event tag. (important: never attempt to manipulate the data in the CRM database directly – bad things will happen to you!).

No comments: