Wednesday, November 9, 2011

CRM 4.0 - Gathering Picklist information via SQL query in Microsoft Dynamics CRM (String Map CRM Table)


Use the following query to gathering information about CRM Picklist.


// Comment
SELECT
[ObjectTypeCode]
,[AttributeName]
,[AttributeValue]
,[LangId]
,[OrganizationId]
,[Value]
,[DisplayOrder]
,[VersionNumber]
,[StringMapId]
FROM DBNAME_MSCRM.[dbo].[StringMap]
where [AttributeName]='PicklistName'
Order by AttributeValue


Thanks,
Nicola Grillo

Wednesday, October 26, 2011

SQL SERVER - How to get Microsoft Dynamics CRM picklist Label via SQL Query (String Map CRM Table)


1. Add in your query the following Left join:


Workaround


LEFT JOIN [Organizationname_MSCRM].dbo.StringMap sm On 

sm.AttributeValue=picklistvalue AND
sm.ObjectTypeCode=3 (Example opportunity=3) AND
sm.AttributeName=''picklistname'' AND
sm.LangId=''1033'' 


2. Use sm.Value to retrieve the Picklist Label

Nicola Grillo

CRM 2011 - Use IOrganizationService in Plugin MSCRM 2011.

Following code allow connects to the Microsoft Dynamics CRM 2011 platform using the IOrganizationService Web Service.

// Comment
//use your prefered userId to get IOrganicazionService by context
private IOrganizationService getService(IServiceProvider serviceProvider, Guid userId)
        {
            IOrganizationServiceFactory serviceFactory =
(IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
            return serviceFactory.CreateOrganizationService(userId);
        }


Thanks,
Nicola Grillo