CRM 2011

How to check if two records are related N:N

Posted on

QueryExpression query = new QueryExpression(relationshipName)
     {
         NoLock = true,
         ColumnSet = new ColumnSet(false),
         Criteria =
         {
             Filters =
             {
                 new FilterExpression
                 {
                     FilterOperator = LogicalOperator.And,
                     Conditions =
                     {
                         new ConditionExpression("accountid", ConditionOperator.Equal, accountID.ToString()),
                         new ConditionExpression("contactid", ConditionOperator.Equal, contactId.ToString()),
                     },
                 },
             }
         }
     };
     var result = service.RetrieveMultiple(query);
There is a catch here, if you have created a self referential N:N relationship then the primary fields are “<fieldname>one” and “<fieldname>two”, so incidentidone and incidentidtwo
Advertisements

CRM Online Partner Instance

Posted on

Hi,

If you are Microsoft CRM Partner and looking for a creating a demo instance that will be valid for more than a month please follow the link below –

https://profile.microsoft.com/RegSysProfileCenter/wizardnp.aspx?wizid=4aa23057-22aa-465d-9064-556dbebce590

keep in mind that you can request up to 5 instances and instance will remain active for upto 12 months

Generating Early Bound entities using CRMSVCUTIL.EXE

Posted on

To generate an entity class for early bound follow the steps below –

 

For CRM On-Premise

1. Ensure you have the latest CRM SDK

2. Launch MSDOS / Command Prompt in Admin mode

2. Go to the SDK Bin folder where CrmSvcutil.exe is available

3. Run following command –

CrmSvcUtil.exe /url:http://<serverName>/<organizationName>/XRMServices/2011/Organization.svc    /out:<outputFilename>.cs /username:<username> /password:<password> /domain:<domainName>    /namespace:<outputNamespace> /serviceContextName:<serviceContextName>

Note – Ensure you are able to browse the organizationservice by opening http://servername/orgname/XRMServices/2011/Organization.svc on your IE.

Also, need to ensure that you pass the correct UserName and Password and the user credentials you are passing has System Admin permissions in CRM.

 

For CRM Online process is slightly different – 

1. Ensure you have the latest CRM SDK

2. Open and build the DeviceRegistration project: SDK\Tools\DeviceRegistration\DeviceRegistration.csproj.

2. Launch MSDOS / Command Prompt in Admin mode

3. Run the executable file from the command line. To register your device, set the /operation parameter to Register.

C:\deviceregistration.exe /operation:Register

4. Copy the displayed device ID and password values and use them as the deviceid and devicepassword parameter values when you run the CrmSvcUtil tool.

5. Go to the SDK Bin folder where CrmSvcutil.exe is available

6. Run following command –

CrmSvcUtil.exe /url:http://<serverName>/<organizationName>/XRMServices/2011/Organization.svc    /out:<outputFilename>.cs /username:<username> /password:<password> /domain:<domainName>    /namespace:<outputNamespace> /serviceContextName:<serviceContextName> /deviceid:<devicepassword from step 4> /devicepassword:<devicepassword from step 4>

Note – Ensure you are able to browse the organizationservice by opening http://servername/orgname/XRMServices/2011/Organization.svc on your IE.

Also, need to ensure that you pass the correct UserName and Password and the user credentials you are passing has System Admin permissions in CRM.

 

Hope it helps!

Source – https://msdn.microsoft.com/en-us/library/gg327844.aspx