Thursday, 3 September 2015

Open Dialog Box in CRM 2013/2015

Hi,
 
Today we got a requirement to get the address from some external system and show them as popup to the user. User selects one of the addresses and we need to do some business operation based on the selection.
 
The challenge is to show the UI like CRM windows so that the user will not see any difference in the UI.
 
After some search came to know that we can do this using XRM Javascript and it is very simple too.
 
Create a HTML webresource and design it as per your requirement.
Make sure you include the reference of ClientGlobalContext.js.aspx in the webresource.

<script type="text/javascript" src="ClientGlobalContext.js.aspx"></script>

Call the web resource using the following code.

var vDialogOption = new Xrm.DialogOptions;
// Set height and width of the window
vDialogOption.width = 100; DialogOption.height = 100;
 
Xrm.Internal.openDialog("Relative_Url_of_the_Webresource", DialogOption, null, null, CallbackFunction);

On the button click, you can also return values from Popup.
 
//Pass the return Value to the parent window
Mscrm.Utilities.setReturnValue(oReturn);
 
Hope this helps
--
Happy CRM'ing
Gopinath

Wednesday, 2 September 2015

Change URL in Dynamics Connector

Today, I have started working with Dynamics Connector.

We did configure all the CRM and Nav settings in the Connector and able to create mappings too. But unfortunately, we gave CRM Service URL with the IP Address which was generated dynamically on our Virtual Machines.

On the next day, all the integration mappings are failing saying it is unable to connect.
I went ahead and changed the URL in the Adapter Settings but no luck. Restarted the services and checked in the Adapter table which is showing the latest URL.

After searching for sometime, came to know that we need to change the Settings.
Note : We did the change in other machine which didn't work. So we have delete the integration and created new one. So, I suggest first try changing the settings and then test.

Hope this helps.
--
Cheers,
Gopinath

Tuesday, 1 September 2015

Steps for Installing Nav 2015

We got a requirement to install Nav 2015 and do some POC on it.

System Requirements
Windows Server 2012
SQL Server 2012

Here are the steps for installing

Double click the Setup.exe in the installation package.
Click Next button in the window of Dynamics NAV 2015 Installation.
Click “I Accept” button to proceed and we don't have any other option too :P
In the next screen, you have two options 
  1. Demo installation :  This is a standard installation type, which will install NAV 2015 Server, NAV 2015 Client, NAV 2015 development environment, MS Office Add-on for Dynamics NAV 2015, and a demonstration database with demonstration license
  2. If you choose B, you will prompted with a popup to choose custom settings.
If you have selected option B in Step 4 you will see the screen which will give you control to customize each feature installation, i.e. Client, Server, Developer
Select Custom option in the above screen.
Choose the following features and click Next button.

Client à Development EnvironmentAdministrative Tools
Server à Page Testability
SQL Server Database Components àDemo Database
Automated Data Capture System
Help Server
Click Once Installer Tool
 
In the next screen, you will asked some of the settings like Destination folder etc..
Don't forget choose SOAP Services Enabled to YES
By default, it will have NavDemo as a SQL Server instance. You can delete and give it as per your wish.
I ignored the warning by clicking the Next button, as I am doing for the POC. You can check the warning and do the needful.
You are done, the installation will start and shows the below screen.
After completing the installation, it will show the installation report of components that were installed.
Search for Microsoft Dynamics Nav 2015 and you will see the below screen.
Hope this helps.

--
Cheers
Gopinath

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