Monday 31 August 2015

Debug a plugin or workflow in CRM 2011/2013/2015

From most of the CRM learners, I hear a question that is very often is How to Debug a plugin/Custom Workflow.
 
Here are the steps that is needed to hit your first break point in the code on your local machine.
 
  • Make sure that your plug-in is signed (For Custom workflow this step is optional)
  • Rebuild the plug-in/Custom workflow.
  • Copy the .pdb file and your .dll file to Microsoft Dynamics CRM\server\bin\assembly (check your Dynamics CRM installation folder, generally C:\Programe Files\)
  • Register the Plug-in/ workflow assembly using the Registration Tool
  • Open the application in Visual Studio and click on Debug -> attach
  • Select w3wp.exe (for plugins) and CRMAsyncService processes( for workflows).

Now go ahead and perform the action in the CRM UI that will trigger the plugin step or the workflow. You will the breakpoint is hit.
 
Hope this helps.
 
--
Happy CRM'ing
Gopinath

Wednesday 26 August 2015

Import Notes with Attachments in CRM 2011/2013/2015

Hi,

All of us have been importing notes and attachments using Scribe or SSIS or Some other tool but the below method uses out of the box import wizard to import all the attachments.

Please follow the steps closely:
  1. Create a abc.csv having the following columns: Title,Description,File Name,Document,Mime Type,Regarding.
  2. In the same spot where you saved the csv file, create a folder with name Attachments and copy all your attachments to this folder.
  3. Select the csv file and attachments folder, right click -> send to -> zip folder
  4. Click on the import data button on the tool bar and perform the usual steps for importing data by selecting the new zip folder (not the csv file or the folder with files)
Note:
  1. Only the files that are not restricted by CRM will be imported. You can check the file attachment restriction by going into system settings area.
  2. Make sure the name of the file in folder matches the file name column of csv file.
  3. Folder name must be Attachments otherwise CRM will not consider it.
Hope this helps.

--
Happy CRM'ing
Gopinath

Tuesday 25 August 2015

Update Dynamic Property Instance(Properties of QuoteProduct/OrderProduct/InvoiceProduct) in CRM 2015

Hi,

We all know that Product Properties is the new features in CRM 2015.

Internally, these records are created in the DynamicPropertyInstance Table.  There are two ways of updating these records.

1) Using Native Update Request.
2) Using UpdateProductProperties Message which expects EntityCollection as input.

The only we need to know is which field to update. Most of you will be surprised why I said which field to update. In this table, the data is update according to the type of the property.

When we add a property to the family, we select the type of the property like Single line of text, Whole Number, Decimal Number etc. And internally CRM has individual columns for each type like ValueString, ValueDecimal, ValueInteger etc.

Even we have DynamicPropertyInstanceId, the challenge is to know the field name to update.

For that thing, we can use RetrieveProductProperty Message which expects input of OrderProduct/QuoteProduct/InvoiceProduct GUID and returns the base property details of the Product. By this, we can determine the type of the property and then use the same to update.


public void UpdateDynamicProductProperty(IOrganizationService iService)
{
     // Get the base product properties.
     RetrieveProductPropertiesRequest objRequest = new RetrieveProductPropertiesRequest();
     objRequest.ParentObject = new EntityReference("salesorderdetail", new Guid(""));
     RetrieveProductPropertiesResponse obj = (RetrieveProductPropertiesResponse)iService.Execute(objRequest);
     EntityCollection entCol = obj.EntityCollection;

     // Retrieve the Properties of the SalesOrderProudct.
     QueryExpression objQueryExp = new QueryExpression();
     objQueryExp.EntityName = "dynamicpropertyinstance";
     objQueryExp.Criteria.AddCondition(new ConditionExpression("regardingobjectid", ConditionOperator.Equal, "CDF9CA4C-B53A-E511-80CE-000D3AA023B6"));
     objQueryExp.ColumnSet = new ColumnSet(true);
     EntityCollection entColDynamicProperties = iService.RetrieveMultiple(objQueryExp);

     // Get the Field name to update.
     EntityReference erfDynamicProperty = (EntityReference)entColDynamicProperties.Entities[0]["dynamicpropertyid"];
     string strAttributeName = GetDynamicPropertyDataType(erfDynamicProperty.Id, entCol);

     // Update the Value of the Dynamice Property Instance.
     Entity entProductProperty = entColDynamicProperties.Entities[0];
     entProductProperty.Attributes[strAttributeName] = "ABCD";
     iService.Update(entProductProperty);
}

private static string GetDynamicPropertyDataType(Guid guidDynamicProperty, EntityCollection entCol)
{
   var entity = entCol.Entities.Single(e => e.Id ==  guidDynamicProperty);
   string strAttributeName = string.Empty;
   if (entity.Contains("datatype"))
   {
        OptionSetValue opsDataType = (OptionSetValue)entity.Attributes["datatype"];
        switch (opsDataType.Value)
        {
            case 3:
               return "valuestring";
            case 4:
               return "valueinteger";
            default:
               return string.Empty;
         }
    }
    return string.Empty;
}

We can also use UpdateProductProperties Request in the same way,  but the request needs entitycollection as an input and updates the properties.

UpdateProductPropertiesRequest objUpdateProductPropertiesReq = new UpdateProductPropertiesRequest();
objUpdateProductPropertiesReq.PropertyInstanceList = entColProperties;
objUpdateProductPropertiesReq.PropertyInstanceList.EntityName = "dynamicpropertyinstance";
var vResponse = iService.Execute(objUpdateProductPropertiesReq);

Hope this helps.

--
Happy CRM'ing
Gopinath

A duplicate lookup reference was found while importing data to CRM 2011/2013/2015

Hi,

Today I got the below error when I imported a contact csv file.

"A duplicate lookup reference was found"

In the .csv file there are only two columns FirstName and Account Lookup. Opened CRM and checked in Account and found that multiple accounts has the same name  and CRM while creating the records was unable to find the exact record and failing by throwing an error.

The fix for it is very simple, we need to find out one value which is unique. When I say unique, the one that comes to our mind is GUID of the record. Well, we can use this too but most of the cases we won't be having the GUID while importing then we can consider Account Number field or some other field which is unique.

After finding the unique field, fill the .csv with the respective values and import it using the wizard. In the wizard while mapping the fields we have a chance of the changing the mapping criteria. Map the unique field and we are done.

Hope this helps.

--
Happy CRM'ing
Gopinath

Monday 24 August 2015

Look Pricing and Use Current Pricing in CRM 2011/2013/2015

In single line,

"if any product price changes while the order is not locked will automatically update the line items."


To lock the pricing on an Order, click the ‘Lock Pricing’ button on the ribbon. Once the pricing has been locked, it can be unlocked again by clicking the ‘Use Current Pricing’ button. Similarly we can use the button on Invoice, Order and Quote etc.. when we use current pricing on an Order, the prices for all related line items will be updated to the current product pricing.

You can test this by adding the product to Order/Invoice/Quote and change the price of the same product and refresh the record, you will see the updated price for OrderProduct/InvoiceProduct/QuoteProduct.

Hope this helps.

--
Happy CRM'ing

Gopinath

Sunday 23 August 2015

CRM 2015 Cross Entity Search

Hi,

One of the good and useful feature that was added in CRM 2015 is Cross entity search.

By default there already some entities that are configured and we can also add other entities and there is a limitation for it. We can include only 10 entities for this search.

For configuring, just navigate to Settings > Administration > System Settings > General


Hope this helps.

--
Happy CRM'ing
Gopinath
 

Saturday 22 August 2015

How to Change the Color of Entity Tiles in the Sitemap?

CRM 2015 Update 1 has given one more feature for us.
 
Now, we can change the color of Entity Tiles in the Sitemap. Here are the steps for it.
 
Microsoft Dynamics CRM > Settings > Customizations and then navigate to the entity you wish to modify
Remove the color from the Color text box and get the colors from here and update it.

Hope this helps

--
Happy CRM'ing
Gopinath

Thursday 20 August 2015

Web service request SetDataSourceCredentials to Report Server http://server/ReportServer failed with SoapException. Error: An error has occurred during report processing. (rsProcessingAborted)

Hi

I got the below exception when I ran OOB report in CRM.

Web service request SetDataSourceCredentials to Report Server http://server/ReportServer failed with SoapException. Error: An error has occurred during report processing. (rsProcessingAborted)

I had installed all things and configured Report Server. This error might be seen for various reasons but mostly when you restart the SQL Server Reporting Service it should be fixed.

Do the following

  1. Restart SSRS service.
  2. Restart SQL Server Agent.
  3. Check Report Extensions are running with some Service Account which is added to the respective groups in AD.

Hope this helps.

--
Happy CRM'ing
Gopinath
 

Documents button is not available for Quote and Invoice in CRM 2015

Hi,

Today I have enabled Document Management on Quote and Invoice entity and installed List Component on sharepoint and integrated CRM with SharePoint.

To my surprise, Documents button was not shown on Quote and Invoice records. After some search came to know that is the bug in CRM 2015 RTM which is fixed in Update 0.1(version 7.0.1.129).

Here is the link of the update

https://support.microsoft.com/en-us/kb/3010990


Hope this helps

--
Happy CRM'ing
Gopinath

How to install Windows Service

Hi,
 
Here are the steps for installing windows service.
 
  • Run Command as Administrator
  • Open “InstallUtil.exe” in Command Prompt. “InstallUtil.exe” tool is available in “C:\Windows\Microsoft.NET\Framework64\v4.0.30319\”.
  • Execute the command Installutil “abc.exe”
 
To Uninstall
 Installutil /u “abc.exe”
 
Note :Prerequisite is .Net Framework 4.0 installed on the machine

Hope this helps.
 
--
Happy Coding,
Gopinath
  

Sunday 16 August 2015

The data has invalid column headings, so you will not be able to re-import it

We always deal with huge data manipulations in CRM. We can update CRM data in many ways.

1) Open the individual record and update it.
2) Use bulk edit and update multiple records in one go.
3) Export data from CRM, make changes offline and then re-import the data.


While following the Re-Import option we rarely get the following the error
The data has invalid column headings, so you will not be able to re-import it.

The issue actually has to do with duplicate display names. Since the export writes the display name as the column name, you cannot have duplicates because CRM doesn’t know how to match up the columns again when it re-imports the data.

In the scenario below, there is an issue with a duplicate status fields; the out-of-box status and a custom status field with the same name.    
  
                             
Good news is CRM 2015 validates the columns before exporting and gives a proper message now.

Hope this helps.

--
Happy CRM'ing
Gopinath

Older than clause in Dynamics CRM Online Update 1

Microsoft Dynamics CRM Online 2015 Update 1 includes additional versions of the ‘Older Than’ clause in Advanced Find and Fetch XML. 

Previously, Advanced Find included the clause ‘Older than X Months’.

However, with the new enhancement in CRM 2015, your searches can be more versatile. Now, the clause ‘Older than X …’ includes options for Minutes, Days, Weeks, and Years, which allow you to retrieve search results that are targeted and relevant. 

There are many instances where these new clauses can be used, especially when you are needing to look for Service Cases, Marketing Campaigns, and Activities in a specific time frame.


Hope this helps.
--
Happy CRM'ing
Gopinath

ExecuteTransactionRequest in CRM 2015 Update 1

We got one more wonderful and powerful feature from CRM 2015 Update 1. i.e ExecuteTransactionRequest
 
Normally, when we do some web application with SQL or some database as a backend we always make use of powerful feature of database transaction. So that we can get the choice of rollback in case an operation fails.

CRM 2015 Update 1 introduced a new feature ExecuteTransactionRequest.
It takes input as a collection of Organization request like Create, Update, Delete, SetState, Assign, any organization request and have CRM execute them in a transaction. And the response of this request also a collection of responses corresponding to every request.

We can read the response for each of the individual request considering the matching index.
 
OrganizationRequestCollection orgRequestCol = new OrganizationRequestCollection();
Entity entContact = null;
var createRequest = null;
for (int intCount= 0; intCount < 3; intCount++)
{
    entContact = new Entity("contact");
    entContact["name"] = string.Format("Test Contact {0}", intCount);
    createRequest = new CreateRequest() { Target = entContact };
    orgRequestCol.Add(createRequest);
}
ExecuteTransactionRequest execTrans = new ExecuteTransactionRequest()
{
   ReturnResponses = true,
   Requests = orgRequestCol
};
ExecuteTransactionResponse response = (ExecuteTransactionResponse)iService.Execute(execTrans);
 
Note :
  • The maximum allowed batch size is 1000.
  • You put a batch of multiple individual requests into one ExecuteTransaction request, which contain a collection of CRM records that you want CRM server to process as a batch
  • If all records have been successfully processed, the whole batch is committed; otherwise if any of the record fails, the whole batch is rolled back (all or none)
Hope this helps.

--
Happy CRM'ing
Gopinath

Thursday 13 August 2015

Where to get 16*16 or 32*32 or any sized images.

Hi,

When we are working on web applications, we might require different images in different sizes. Sometimes, we find a image in some size where we might want it either bigger or smaller.

I prefer https://www.iconfinder.com/ is the one of the best places where you can any image.

Please do let me share if you have any other good site to get the images.

Hope this helps.

--
Happy Searching
Gopinath
 

Visio Open Group and Close Group

Hi,
 
We use Groups in Visio for grouping the things. Sometime, we might need to edit the existing group and add it to the main diagram.
 
We can open group by right clicking and selecting Open Group but after opening the group I could not find the option to close the group. To my surprise, it took some time to find the option for me.
  
The solution is to use Switch Windows button which is there at the edge of Visio.
 
Hope this helps.
 
--
Happy Documentation
Gopinath

Calculate Age of the record or Days from record creation in CRM 2015 Online

Hi,

Normally we get the requirement of calculating the age of the opportunity record or some other record for reports or analysis. We used to do by some custom code either a scheduled workflow or some scheduled application.

In CRM 2015 Update 1, there is a new thing added to Calculated Fields i.e DIFFINDAYS

We can use this for calculating the age of the record.

Note: The DIFFIN functions were introduced in Microsoft Dynamics CRM Online 2015 Update 1. They aren’t available in Microsoft Dynamics CRM 2015 and Microsoft Dynamics CRM Online 2015 Update.

Hope this helps.

--
Happy CRM'ing
Gopinath

Re-install SQL Server Reporting Services

Sometimes there might be need to re-install SQL Server Reporting Services after spending lot of time on an issue. You decide to uninstall  and install it but when you go and search in Control Panel you won't find any component. Here is the way for it.
 
  • Log on to Server with the SQL Reporting Services open the Control Panel
  • Navigate to Programs and Features (Add \ Remove Programs)
  • In the Uninstall or Change a Program list select Microsoft SQL Server 2012 (64-bit)
  • Click the Uninstall\Change option at the top of the list
  • On the SQL Server 2012 Dialog, click Remove
  • On the Setup Support Rules Dialog, click OK
  • On the Select Instance Dialog, assure the correct instance is select and click Next
  • On the Select Features Dialog, place a check mark next to Reporting Services - Native and click Next
  • On the Removal Rules Dialog, click Next
  • On the Ready to Remove Dialog, click Remove
  • On the Complete Dialog, click Close
  • Perform a reboot.
Hope this helps
 
--
Happy Coding
Gopinath