Wednesday, September 23, 2015

Microsoft Visual Studio is waiting for an operation to complete


Microsoft visual studio is busy waiting for an operation to complete

If you encounter Microsoft Visual Studio is waiting for an internal operation to complete then you should try killing rdpclip.exe
 

Thursday, June 25, 2015

CRM CONSULTANT VS CRM DEVELOPER

One of the thing which needs to be clear to clients, companies when we work on projects is the role of a consultant and role of the developer in the projects. This becomes more important when we have larger implementations and multi-geography teams and deployments to handle.
clip_image002
CRM consultant’s is an expert who will visit clients (or be a semi-permanent contractor in an organisation) and advise them on their CRM systems, train employees in
the use of the CRM systems, configure/set up/customise their CRM systems and possibly design/develop software for that organisation (or at least provide a design
spec/requirements for the software and manage the project with software developers).
CRM Developer’s will work on a broad spectrum of work, however, it’s likely to be designing/developing software for a specific purpose or design brief with little or no involvement with the end client.
Or it could be in-house software development for the IT systems of the company that you are working for.
CRM consultant’s is primarily a customer facing function and lot of it involved not only techno-functional skills but also communication skills, presentation skills alongside.
A Technical consultant will also need to possess great CRM and .net technical experience set as well.
CRM developer’s on the other hand is very hands-on job, primarily focused on technical delivery and to develop and package new services and/or offerings in line your organisation and client expectations.
CRM Consultant’s job is also to contribute to the participation in scoping, estimating and risk management efforts.
Also, to participate in building knowledge capital, improving the aptitude of your team by sharing your technical knowledge and experience.
CRM developer’s primary focus is to deliver code maintaining code quality, unit testing and fix bugs with least number of bugs introduced to the project.
CRM Consultant job is to suggest the best possible solution to problem and making it an easy job for the customer to select the best option.
It might be his/her job to complete technical delivery as well.
CRM developer’s need to have not only sound background of CRM but also of Unit testing frameworks.

Referred from Deepesh Somani blog.

Friday, June 19, 2015

Common reasons for slow form loading in MS CRM

The main reason of slow loading forms are
Busy Javascript onload functions
Too many subgrids
Lots of oData/fetchXML queries
Tabs, sections and fields not needed on the form
bad/slow coding
We had our list of worst performing forms and we had a quick look at them and made some quick notes
How many unfiltered OData retrieves
How many OData calls, where they retrieving the same set
Number of ribbon buttons
potential fields/functionality which could be removed by change of business process
size of Javascript onload function

Finding the Slow Forms
Fiddler
One of the tools I used to analyize the slow loading CRM forms was fiddler.  I wrote a blog post about Getting Started with Fiddler and CRM.  It’s a great tool to see what calls are being made from the page, how long they took and how much data they were bringing back.
Looking at the fiddler logs I was able to investigate the OData queries and find
Which OData calls took the longest
Find OData calls which were not filtered
Find OData calls which were retrieving the same data multiple times
general loading times of sections of code
F12 Debugger
The F12 debugger is such an awesome tool for debugging Javascript.  I put in a break point in the onload Javascript and walked through the code.
We are using two main methods to find slow loading code
Looking at the code
Stepping through the code

How to speed up form loading
In some of the forms we were retrieving fields from related entities but to speed up the form the customer was happy to use lookups and click those for more information if it was needed.   This saved OData queries
These changes can remove some of the code triggered on the Javascript onload.
Improvements can come from moving fields and subgrids into unexpanded tabs where the loading can be delayed until the tab is expanded
Remove unwanted/unused fields
CRM Developers have to refactor their code then I think CRM Forms and entities should be refactored to remove the noise of unused fields.
There is a great tool to help you with this called CRM Data Detective it will show you what fields are being used/not used by seeing if any values were written to those fields.  The CRM Data Detective is a free tool which works with CRM 2011 and CRM 2013.

Monday, June 1, 2015

SECURE VS UNSECURE CONNECTION STRING IN MS CRM

Then in the Constructor of your plugin class you will get the configuration value which you can use later in the Execute method:
public abstract class BasePlugin : IPlugin
{
    
private string _secureConfig = null;
    
private string _unsecureConfig = null;

    
public BasePlugin(string unsecureConfig, string secureConfig)
    {
        _secureConfig = secureConfig;
        _unsecureConfig = unsecureConfig;
    }

    
public void Execute()
    {
        
// Use the configuration here
    }
}


PROS:

·                     The step configuration is solution-aware so it will be automatically transported with the plugin step.
CONS:

·                     You need to use the plugin registration tool or another application to update the step configuration.
·                     The configuration is step-specific so you have to provide it and/or update it for every step even if the value is the same for all the steps (the configuration is on each step instead of the assembly or plugin type).
·                     the configuration is just an attribute of the plugin step so you cannot control privileges on the configuration independently from privileges on plugin step entity.


Sharing and Unsharing Records in CRM 2011/2013

Hi All, Here I am going to share Account record with a user and then unsharing the account from the user in CRM 2011. Here is the logic to share and unshare records

sharing
 // Create the request object and set the target and principal access
GrantAccessRequest grantRequest = new GrantAccessRequest()
            {
                Target = new EntityReference(Account.EntityLogicalName, accountId),
                PrincipalAccess = new PrincipalAccess()
                {
                    Principal = new EntityReference(SystemUser.EntityLogicalName, userId),
                    AccessMask = actionRights
                }
            };

 // Execute the request.
GrantAccessResponse granted = (GrantAccessResponse)service.Execute(grantRequest);

Unsharing 
 // Create the request object and set the target and revokee.
            RevokeAccessRequest revokeRequest = new RevokeAccessRequest()
            {
                Target = new EntityReference(Account.EntityLogicalName, accountId),
                Revokee = new EntityReference(SystemUser.EntityLogicalName, accountuserId)
            };

// Execute the request.

 RevokeAccessResponse revoked = (RevokeAccessResponse)service.Execute(revokeRequest);

Actions that can be automated in MS CRM

Normally, progressing along the business process depends on user input. As a developer, you can perform the same actions programmatically in form scripts.

Change the process when there are more than one process available for the entity.
Use Xrm.Page.data.process.getEnabledProcesses to retrieve information about enabled processes that the user can choose for the entity. Then useXrm.Page.data.process.setActiveProcess to make one of the enabled processes the active one.

Move to the next stage when all required steps are completed to make it the current active stage.
Use Xrm.Page.data.process.moveNext.

Move to the previous stage and make it the current active stage.
Use Xrm.Page.data.process.movePrevious.

Select a stage to view the status of the steps in the stage.
Use Xrm.Page.data.process.getActivePath to retrieve information about the stages that have been completed, the current active stage, and valid stages available from the current active stage. Examine the steps included in that stage and compare the corresponding form attribute values to determine whether they are completed.

Complete a step
Steps are completed when the corresponding data in the form is entered. You can determine the attribute using the step getAttribute method. This will return the logical name of the attribute. Then use Xrm.Page.getAttribute to retrieve attribute from the Xrm.Page.data.entity.attributes collection and then use the attribute setValue method to set the value.

Detect whether a step is required
Use the step isRequired method to determine if a step is required by the business process flow.

Expand or collapse the business process flow control
Use Xrm.Page.ui.process.setDisplayState.
There are also some things you can do as a developer that a user cannot perform.

Hide the process control
Use Xrm.Page.ui.process.setVisible, you can control whether to display the business process flow control.

Skip to a valid completed stage.
Use Xrm.Page.data.process.setActiveStage to set one of the valid completed stages for the current entity.

Query the process definition including stages not currently visible

Use Xrm.Page.data.process.getActiveProcess to query the definition of the business process flow, including stages that might not be visible because of branching logic in the process.

Events for business process flows
You can interact any event provided by the form with business process flows, but two new events allow you to execute code based on events just for the business process flow control. You can execute code when the active stage of a business process flow changes (OnStageChange event) or when a stage is selected (OnStageSelected event).

Neither of these new events provide a user interface to register your event handlers. You must use methods provided to add or remove handlers for these events in the form OnLoad event.. More information: Business Process Flow control events

Friday, March 20, 2015

Scripting tit-bits for Business Process stage field: Dynamics CRM 2013 Javascript

We were facing lot of issues in trying to show hide , set disabled / enable fields or nullify fields which were not present as fields on form in Dynamics CRM 2013 but just were accessible on business process stage on the form. Here are the ways to do the same I found:
Enable/Disable Business Process stage field:
Xrm.Page.getControl(‘header_process_fieldname’).setDisabled(false);  //Enabled
Xrm.Page.getControl(‘header_process_fieldname’).setDisabled(true);  //Disabled
Show/Hide Business Process stage field:
Xrm.Page.getControl(‘header_process_fieldname’).setVisible(true);  //Show
Xrm.Page.getControl(‘header_process_fieldname’).setDisabled(false);  //Hide
Get Value/ Set Value Business Process stage field:
Xrm.Page.getControl(‘header_process_fieldname’).getAttribute().setValue(value);  //Set Value
Xrm.Page.getControl(‘header_process_fieldname’).getAttribute().getValue();  //Get Value
Set and Remove Notification on Business Process stage field:
Xrm.Page.getControl(‘header_process_fieldname’).setNotification(“Notificationmessage”);  //Set Notification message
Xrm.Page.getControl(‘header_process_fieldname’).clearNotification(); // Clear Notification message
Set Required levels on Business Process stage field:
(Xrm.Page.getControl(‘header_process_fieldname).getAttribute()).setRequiredLevel(‘required’); //Required level
(Xrm.Page.getControl(‘header_process_fieldname).getAttribute()).setRequiredLevel(‘none’); //none level
(Xrm.Page.getControl(‘header_process_fieldname).getAttribute()).setRequiredLevel(‘recommended’); //Recommended level

Note: I have noticed this code will work when current stage field in business process on form is visible on UI.

Change color for text fields :Dynamics CRM 2013

Sometimes we get requirement to change the forecolor for some fields in Dynamics CRM 2013 in order to highlight them in different color. So we implemented following script:
You can add the scripts on-load or based on some condition.
For changing color during field is non-selected:
//Setting red color
$(‘#fieldname’).find(‘div[class="ms-crm-Inline-Value"]‘).css(‘color’,color);

In order to change color during field is typed:
//Setting color blue during typing of field
$(‘#fieldname_i’).css(‘color’, color);

Note: This is unsupported script and may break in future if Microsoft changes something.

Get/Set currency field values in JavaScript for Dynamics CRM

I noticed a scenario where currency field value on CRM forms were not accessible using Xrm.Page.getAttribute(“Currency field name”).getValue() and 
Xrm.Page.getAttribute(“Currency field name”).setValue(Value)
The resolution is in such cases you can access currency fields in below manner:
// To get currency field
Xrm.Page.data.entity.attributes.get(“Currency field name”).getValue();
// To set currency field
Xrm.Page.data.entity.attributes.get(“Currency field name”).setValue(Value);

JavaScript Dependency Checker for Dynamics CRM 2011/2013

JavaScript Dependency Checker for Dynamics CRM 2011/Dynamics CRM 2013 is utility for all CRM administrators, consultants who have to deal with JavaScript issues on CRM 2011/CRM 2013 and want a quick way to document scripts. It is also very useful during product upgrades. 

Thank you to all

Thank you to all who have been reading my blog articles and have commented and sent personal messages. 

I started again posting in the blog after a long break!!! 

It means a lot to me to know some of my content might be helping. 

Monday, November 3, 2014

DataGrid Export to Excel

//btnExporttoExcel
Response.Clear();
Response.Buffer = true;
Response.ClearContent();
Response.ClearHeaders();
Response.Charset = "";
string FileName = "MS EXCEL" + DateTime.Now + ".xls";
StringWriter strwritter = new StringWriter();
HtmlTextWriter htmltextwrtter = new HtmlTextWriter(strwritter);
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/vnd.ms-excel";
Response.AddHeader("Content-Disposition", "attachment;filename=" + FileName);
dgpayment.GridLines = GridLines.Both;
dgpayment.HeaderStyle.Font.Bold = true;
dgpayment.RenderControl(htmltextwrtter);
Response.Write(strwritter.ToString());
Response.End();

//another method

public override void VerifyRenderingInServerForm(Control control)
        {
            //
        }

Business Process stage field: Dynamics CRM 2013 Javascript

Enable/Disable Business Process stage field:
Xrm.Page.getControl(‘header_process_fieldname’).setDisabled(false);  //Enabled
Xrm.Page.getControl(‘header_process_fieldname’).setDisabled(true);  //Disabled
Show/Hide Business Process stage field:
Xrm.Page.getControl(‘header_process_fieldname’).setVisible(true);  //Show
Xrm.Page.getControl(‘header_process_fieldname’).setDisabled(false);  //Hide
Get Value/ Set Value Business Process stage field:
Xrm.Page.getControl(‘header_process_fieldname’).getAttribute().setValue(value);  //Set Value
Xrm.Page.getControl(‘header_process_fieldname’).getAttribute().getValue();  //Get Value
Set and Remove Notification on Business Process stage field:
Xrm.Page.getControl(‘header_process_fieldname’).setNotification(“Notificationmessage”);  //Set Notification message
Xrm.Page.getControl(‘header_process_fieldname’).clearNotification(); // Clear Notification message
Set Required levels on Business Process stage field:
(Xrm.Page.getControl(‘header_process_fieldname).getAttribute()).setRequiredLevel(‘required’); //Required level
(Xrm.Page.getControl(‘header_process_fieldname).getAttribute()).setRequiredLevel(‘none’); //none level
(Xrm.Page.getControl(‘header_process_fieldname).getAttribute()).setRequiredLevel(‘recommended’); //Recommended level

Note: I have noticed this code will work when current stage field in business process on form is visible on UI.

Get/Set currency field values in JavaScript for Dynamics CRM

We Cannot use the below code to retrieve the currency field value
Xrm.Page.getAttribute(“Currency field name”).getValue() and Xrm.Page.getAttribute(“Currency field name”).setValue(Value)

The resolution is in such cases you can access currency fields in below manner:
// To get currency field
Xrm.Page.data.entity.attributes.get(“Currency field name”).getValue();
// To set currency field

Xrm.Page.data.entity.attributes.get(“Currency field name”).setValue(Value);

Tuesday, October 28, 2014

Xrm.Utility.openEntityForm for Dynamics CRM 2013/2011

Open a new account record using JavaScript
Xrm.Utility.openEntityForm(“account”);

Open an existing account record JavaScript
Xrm.Utility.openEntityForm(“account”,”A85C0252-DF8B-E111-997C-00155D8A8410″);

Open a new account record with a specific form and setting default values JavaScript
var parameters = {};
parameters["formid"] = “b053a39a-041a-4356-acef-ddf00182762b”;
parameters["name"] = “Test”;
parameters["telephone1"] = “(425) 555-1234″;

Xrm.Utility.openEntityForm(“account”, null, parameters);

Open a new record with setting form values for regardingobjectid will not work. So, in that case, the Workaround? Here we go:

Open Form Script

//set the parameters to pass to the new form
var parameters = {};
var Regarding = Xrm.Page.getAttribute(“regardingobjectid”).getValue();
parameters["parameter_regardingid"] = Regarding[0].id;
parameters["parameter_regardingname"] = Regarding[0].name;
parameters["parameter_regardingtype"] = Regarding[0].entityType;
//Open the new form
Xrm.Utility.openEntityForm(“appointment”,null,parameters);

onLoad Script for new form which needs to be opened:

// Get the Value of the Regarding through the Customer Parameters
var param=Xrm.Page.context.getQueryStringParameters();
var regardingId=param["parameter_regardingid"];
var regardingName=param["parameter_regardingname"];
var regardingType=param["parameter_regardingtype"];
//Populate the Regarding if there is one
if (regardingId != undefined)

  {Xrm.Page.getAttribute(“regardingobjectid”).setValue([{id:regardingId, name:regardingName, entityType:regardingType}]);}  

Tuesday, October 7, 2014

MIGRATION FROM CRM 4.0 TO DYNAMICS CRM 2013

Migration from CRM 4.0 to Dynamics CRM 2013 is not a single step procedure, but it is nevertheless not difficult either. The steps involved would be to first move to CRM 2011 and then progressively upgrade to Dynamics CRM 2013. There exists no direct upgrade option from CRM 4.0 to Dynamics CRM 2013.
When migrating from CRM 4.0 to Dynamics CRM 2011, there are no changes in customizations required, as CRM 2011 supports all CRM 4.0 javascripts, plugins and DLLs. Dynamics CRM 2013 does not support some CRM 4 DLLs, SDKs, javascrips and plugins. These are to be checked prior to start of migration process and disabled to ensure a successful migration. The Legacy feature check tool from Microsoft helps to check all customizations which are unsupported by Dynamics CRM 2013. The Legacy feature check tool can be obtained from here and this document provides more inputs on these customizations.
After running the legacy feature check tool and the plugins and javascript issues are dealt with, the migration process to Dynamics CRM 2013 from CRM 2011 can be started. The customizations from CRM 2011 are supported by Dynamics CRM 2013, hence only the CRM 4 plugins need to be re-written for CRM 2011. The other option is to remove all CRM 4.0 customizations, migrate it to CRM 2011, and then to Dynamics CRM 2013, following which the customizations can be implemented in Dynamics CRM 2013 itself.

A Broad Outline Of Steps To Be Followed Are

  1. Software requirements and support to be checked on the server
  2. Plugins, workflows and java scripts to be checked using legacy feature check tool
  3. Remove all CRM 4.0 customizations prior to start of migration to CRM 2011
  4. Enable customizations in CRM 2011 if required
  5. Continue migration to Dynamics CRM 2013
  6. Add all the removed customizations to Dynamics CRM 2013, if not added earlier to CRM 2011

Some Issues That We Faced

  • The database table field length differences affected usability after migration. This has to be checked as there are differences in allowed field lengths between CRM 4.0, CRM 2011 and Dynamics CRM 2013
  • CRM 4.0 web services API were not removed prior to migration to Dynamics CRM 2013 which disrupted the upgrade. This customization was required to be removed and re-implemented in Dynamics CRM 2013
When migrating from CRM 2011 to Dynamics CRM 2013, the server can not be rolled back to CRM 2011. And to proceed with the migration, there are predominantly two different methodologies to follow, based on availability of resources. For a detailed document on migration from CRM 2011 to Dynamics CRM 2013.
Reference Link: http://www.nalashaa.com/migration-crm-4-0-dynamics-crm-2013/