Thursday, 30 July 2015

Complete Label is not Displayed in CRM 2013 and 2015

Hi,

We often deal with many attributes with really bigger names. In CRM 2013/2015, you might see the field name is not completely displayed on the form.

Don't worry, there is a solution for this.

Just Goto FormEditor àSectionàPropertiesàChange the Width

By default the width is 115 and we can change it.
                       
                 
 
 
Hope this helps.

--
Happy CRM'ing
Gopinath
 

Get all attributes of the records in CRM

Hi,
 
Many times there could a requirement where we need to get most of the attributes of a record in CRM. Then, we can write the code to get all attributes.
 
Here is the code for it.
 
We can achieve this by using two things
1) Fetch XML
  In FetchXML, if you forgot to mention attribute tag by default it will get all the attributes.
 
string strFetchXML = @"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>
   <entity name='account'>
   </entity>
   </fetch>";
EntityCollection entColAccounts = iService.RetrieveMultiple(new FetchExpression(strFetchXML));

strFetchXML = @"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>
   <entity name='account'>
   <all-attributes/>
   </fetch>";
 entColAccounts = iService.RetrieveMultiple(new FetchExpression(strFetchXML));
2) QueryExpression
 
QueryExpression objQueryExpression = new QueryExpression("account");
objQueryExpression.ColumnSet = new ColumnSet(true);
entColAccounts = iService.RetrieveMultiple(objQueryExpression);
 
Note: Mostly avoid retrieving the record with the all-attributes  as there could be lot of performance degrade. It is always best and recommended way to mention the specific attributes and retrieve records from CRM.
 
Hope this helps.
 
--
Happy CRM'ing
Gopinath

RetrieveProductPropertiesRequest message in CRM 2015

Hi,

In CRM 2015, we have new feature of having properties to the Products. Sometimes, we get a requirement to retrieve them using SDK.

We can retrieve them in two ways
1) Using the new message - RetrieveProductPropertiesRequest
2) Using our ever green Fetch XML

RetrieveProductPropertiesRequest expects a parent object(entityreference) for retrieving the properites of the product. Parent Object can be Quote Product, Opportunity Product, Invoice Product or Order Product.

RetrieveProductPropertiesRequest objRetrieveProductPropertyReq = new RetrieveProductPropertiesRequest();
objRetrieveProductPropertyReq.ParentObject = new EntityReference("quotedetail", new Guid(""));
RetrieveProductPropertiesResponse objRetrieveProductPropertiesResponse = (RetrieveProductPropertiesResponse)iService.Execute(objRetrieveProductPropertyReq);
EntityCollection entProductProperties = objRetrieveProductPropertiesResponse.EntityCollection;


If you are using Fetch XML, just the guid of Quote Product, Opportunity Product, Invoice Product or Order Product against regardingobject.

string strFetchXML = @"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>
   <entity name='dynamicpropertyinstance'>
   <filter type='and'>
   <condition attribute='regardingobjectid' operator='eq' value='{}' />
   </filter>
   </entity>
   </fetch>";
EntityCollection entColDynamicProperties = iService.RetrieveMultiple(new FetchExpression(strFetchXML));

Hope this helps.

--
Happy CRM'ing
Gopinath

Friday, 24 July 2015

Tab Events in CRM

Hi,

We got a requirement to do perform action on Tab expand and Collapse. To my goodness, CRM has provided Tab events. 

Here is the code which I have written.

function ShowTabStatus() {
    var currTabState = Xrm.Page.ui.tabs.get("tab_more").getDisplayState();
    if (currTabState == "expanded") {
        alert("Collapsing...");
    }
    else {
        alert("Expanding...");
    }
}

 


We can get the DisplayState and SetDisplayState of the tab too.

Here is the MSDN link for it.

Hope this helps.

--
Happy CRM'ing
Gopinath

The entity cannot be closed because it is not in the correct state in CRM

Hi All,
 
Today when I was working with Quote Activate, Won and Lost got the below error in CRM.
 
"The entity cannot be closed because it is not in the correct state"

 
This message doesn't tell us what exactly does it mean by correct state. After sometime, I came to know that only Activated Quote can be closed as Won or Lost
 
I was closing a quote from a workflow as below like
 
Changed the steps to check and activate the quote if the status is Draft.
 
 
 
Hope this helps.
 
--
Happy CRM'ing
Gopinath 

Thursday, 23 July 2015

Login failed for user domain servername$

Hi,

Today, I was working on a webservice which connects to SQL Server Database and inserts some record.
 
My connection string in the config file is as follows.
 
Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=DataBase;Data Source=(local) 
 
Hosted the service on IIS and tried by calling it. The method was failing by throwing the below exception
 
login failed for user domain/servername$
 
Given all the permissions to Network service and one of the user on the DB which the service is connecting but no use.
 
Copied the code to Console Application and executed it. To my surprise, it worked fine. Then by this, I confirmed that the issue was not in the code or connection string and it was something with IIS.
 
The problem was the Application Pool Identity. The identity was set to the Built-in Account in the Advanced Settings of App pool, instead change it to one of the user account which has access to Database.
 
 
Hope this helps.
 
--
Happy Coding
Gopinath

Saturday, 18 July 2015

The type or namespace 'Xrm' does not exist in the namespace 'Microsoft'(are you missing an assembly reference?) Error in CRM 2015

I was getting the below error while building a Plugin Project. I was really shocked and checked the references which has Micrsoft.XRM.SDK.dll 7.0 version referenced.

Reason for it is CRM 2015 SDK was built on .Net 4.5.2 Framework and the Visual studio does not support 4.5.2.


  • Just download .Net Framework 4.5.2 from here
  • Goto Project Properties and change the framework. 


Hope this helps.

--
Happy CRM'ing
Gopinath.

Thursday, 16 July 2015

Update the content of Activated Quote in CRM

Hi,
 
We got a situation as, the quote should activated for triggering a workflow and from workflow on based on some conditions we need to update the same quote. This is not possible as the quote becomes Read-Only immediately after you activate.
 
If we want to update it, the option is revising the quote which closes the current quote and creates a new quote where we don't want to create new quotes.
 
After some search, we found a way for doing it and the way is very simple. Just change the state of quote to Draft, update the data and then change the quote state to Active which will not create any new quote.
 
We can do this using a system workflow and also from SDK.
 
System Workflow
 
SDK
// Change the Quote to Draft State
SetStateRequest draftQuote = new SetStateRequest();
draftQuote.EntityMoniker = new EntityReference("quote", new Guid(""));
draftQuote.State = new OptionSetValue(0); // Draft
draftQuote.Status = new OptionSetValue(1); // InProgress
objService.Execute(draftQuote);

// Update the Quote
Entity entQuote = new Entity("quote");
entQuote.Attributes["name"] = "testing1";
entQuote.Id = new Guid("DA5768B5-D62A-E511-80E0-FC15B4283778");
objService.Update(entQuote);

// Change the Quote to Active State.
SetStateRequest activateQuote = new SetStateRequest();
activateQuote.EntityMoniker = new EntityReference("quote", new Guid(""));
activateQuote.State = new OptionSetValue(1); // Active
activateQuote.Status = new OptionSetValue(2); // InProgress
objService.Execute(activateQuote);

Hope this helps.

--
Happy CRM'ing
Gopinath 

Get the Plugin DLL from Database or Managed Solution in CRM 2011/2013/2015

Hi,

There might be many situations where we would want to get the Plugin.dll from Database or Managed Solution in CRM 2011/2013/2015.

Here is the way for it.

QueryExpression objQueryExpression = new QueryExpression("pluginassembly");
objQueryExpression.ColumnSet = new ColumnSet(true);
objQueryExpression.Criteria.AddCondition(new ConditionExpression("name", ConditionOperator.Equal, "CRM.Test.PluginsAndWorkflows"));
EntityCollection entCol = objSerivce.RetrieveMultiple(objQueryExpression);
byte[] assembly = Convert.FromBase64String(entCol.Entities[0]["content"].ToString());
File.WriteAllBytes(entCol.Entities[0]["name"].ToString() + ".dll", assembly);

--
Hope this helps.
Gopinath

Wednesday, 15 July 2015

Install a DLL to the GAC on Windows Server 2012 using only PowerShell (without Visual Studio)

Prior to Windows Server 2012 I had been used to install DLL files in the Windows Global Assembly Cache (GAC) by either opening the Windows/Assembly folder and simply dragging and dropping the file, or by using GacUtil.exe

In Windows Server 2012 unfortunately drag and drop feature is gone and with out installing visual studio, you won't get GacUtil.exe.

Here is the way to register DLL to GAC using PowerShell.

Add a DLL to the GAC
Run the SharePoint PowerShell console as Administrator.
Execute the following command.


Set-location "c:\Dll"
[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
$publish = New-Object System.EnterpriseServices.Internal.Publish
$publish.GacInstall("c:\Dll\Sample.dll")
iisreset

Remove a DLL from GAC
Run the SharePoint PowerShell console as Administrator.
Execute the following command.


Set-location "c:\Dll"
[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
$publish = New-Object System.EnterpriseServices.Internal.Publish
$publish.GacRemove("c:\Dll\Sample.dll")
iisreset

Hope this helps
--
Happy Coding
Gopinath

 

Tuesday, 7 July 2015

Get the Datatype of attribute using JavaScript in CRM 2013/2015

Hi,
 
We can get the datatype of the attribute using JavaScript in CRM.
 
Here is the syntax for it.

Xrm.Page.getAttribute("<AttribueSchemaName>").getAttributeType()

This method will return one of the following string values
  • boolean
  • datetime
  • decimal
  • double
  • integer
  • lookup
  • memo
  • money
  • optionset
  • string 
Hope this helps

--
Happy CRM'ing
Gopinath

SQL Server Reporting Services Account is a local user and is not supported

Today when I was installing SrsDataConnector after installing CRM got the following error.

"SQL Server Reporting Services Account is a local user and is not supported"

A quick search gave me the reason of the error and also the solution to resolve it.

Reason -- Whenever we install SQL Server Reporting Services using default settings, the service account will be set to ReportServer. And we cannot install SrsDataConnector with Report Server account.
 
  • Search and Open the Reporting Services Configuration Manager
  • Update the Use built-in account to "Local System"
  • While updating Service Account, system asks you “Backup Encryption Key” with below screen.
  • Close the "SrsDataConnector" installation wizard and Start again. This time you won't see any issue.
 Hope this helps.
 
--
Happy CRM'ing
Gopinath

Sunday, 5 July 2015

Disable Send Report to Microsoft Pop Up in CRM

Hi,
 
I see many customers asking to disable the Send Report to Microsoft Pop Up in CRM and there is a supported to do that.

Settings –> Administration –> Privacy Preferences –> tick box and select Never send

Hope this helps.
--
Happy CRM'ing
Gopinath

Hide Get CRM for Outlook on the Message Bar

Hi

In CRM, you might have seen many times a message on the top message bar which says 'Get CRM for Outlook'

Here is the way to disable it.
  • Navigate to Microsoft Dynamics CRM > Settings > Administration
  • Click on System Settings > Outlook tab
  • You will see a section by name 'Users see Get CRM for Outlook option displayed on the message bar.'
  • Set that option to ‘No’

Hope this helps.

--
Happy CRM'ing
Gopinath

Data Centers and Discovery URL's of CRM

For Microsoft Dynamics CRM 2015 and Microsoft Dynamics CRM Online 2015 Update installations, server and organization allocation may change as part of datacenter management and load balancing. Therefore, the IDiscoveryService Web service provides a way to discover which Microsoft Dynamics CRM server is serving your organization at a given time.

The following table lists the Web service URLs for the worldwide Microsoft Dynamics CRM Online data centers.
North Americahttps://dev.crm.dynamics.com/XRMServices/2011/Discovery.svcMicrosoft account
 https://disco.crm.dynamics.com/XRMServices/2011/Discovery.svcMicrosoft Office 365
North America 2https://disco.crm9.dynamics.com/XRMServices/2011/Discovery.svcMicrosoft Office 365
Europe, Middle East and Africa (EMEA)https://dev.crm4.dynamics.com/XRMServices/2011/Discovery.svcMicrosoft account
 https://disco.crm4.dynamics.com/XRMServices/2011/Discovery.svcMicrosoft Office 365
Asia Pacific Area (APAC)https://dev.crm5.dynamics.com/XRMServices/2011/Discovery.svcMicrosoft account
 https://disco.crm5.dynamics.com/XRMServices/2011/Discovery.svcMicrosoft Office 365
Oceaniahttps://disco.crm6.dynamics.com/XRMServices/2011/Discovery.svcMicrosoft Office 365
Japan (JPN)https://disco.crm7.dynamics.com/XRMServices/2011/Discovery.svcMicrosoft Office 365
South Americahttps://disco.crm2.dynamics.com/XRMServices/2011/Discovery.svcMicrosoft Office 365
 
For more information please check this
Hope this helps.
 
--
Happy CRM'ing
Gopinath

Remove Export To Excel Option in CRM

Hi,

One day when we were talking to customer, we were asked to remove Export to Excel button from complete CRM for some of the users.

We thought of doing this by using Display Rules but as we all know CRM is very smart, it gave us an option in security roles where you can remove the permission.

You can find the option in Business Management of Security Role window.

Hope this helps.

--
Happy CRM'img
Gopinath

Clearing a Field value using Business Rules

Business Rules are an excellent way to achieve simple validations without coding in CRM. The Spring Release of Dynamics CRM 2015 has enhanced the functionality of the Business Rules defined in CRM 2013 to now allow for the ability to clear values in a field.
 
This can enhance the validity of records in your CRM system while ultimately creating less work for you in the long run.
 
How to Clear a Field Value Using Business Rules 
  • Navigate to the Business Rules area in CRM 2015 by going to Solutions, choosing the desired entity, and then selecting Business Rules
  • Click New Business Rule.
  • Add the Condition 'If Clear Field equals Yes'
  • Add the Action 'Clear Updated By'
Note: If you don’t see the "clear" option in your pick list when setting a field value, check that the requirement for the field you are trying to clear is not set to Business Required. Business Rules will not allow you to clear a required field.
 
--
Hope this helps
Gopinath
 

Wednesday, 1 July 2015

Deleting Microsoft dynamics CRM organization from SQL

Sometimes, we might get the issue when deleting the organizations from on premise CRM.

Here is the procedure to delete Dynamics CRM Organization from Database. 
  • Connect to CRM DB server and right click on CRM organization DB (for example DEMO_MSCRM)
  • Select Delete and make sure to select Close existing connections.

This will delete organization DB , but we also need to remove Organization references from MSCRM_CONFIG DB, so follow below steps.
  • Open SQL Server Management Studio
  • Select MSCRM_CONFIG, right click and select New Query.
  • Execute the below query
            select * from [dbo].Organization
  • Note down ID of the organization which you wanted to delete.
  • Execute the following queries.
           delete from [dbo].[OrganizationFeatureMap] where OrganizationId='ORG_GUID'
           delete from [dbo].SystemUserOrganizations where OrganizationId='ORG_GUID'
           delete from [dbo].[OrganizationProperties] where Id='ORG_GUID'
           delete from dbo.Organization where DatabaseName='ORGNAME_MSCRM'

Note: This is an unsupported method of removing Organization DB and should be used only when not able to delete organization from Deployment Manager for specific reasons.

Hope this helps.
--
Happy CRM'img
Gopinath