Wednesday, December 17, 2008

MS CRM 5.0 new features

A look at MS CRM 5.0

Features for End Users:

Ribbon Menu – RibbonMenu as in Office 20007 will appear on top of the form in MS CRM 5.0. A customizer can still customize the toolbar and add user defined buttons to this menu by modifying ISV.Config file.

 

Modified Enity Forms - In CRM 4.0, tabs were used to display and group data but in MS CRM 5.0 there would be a navigation on the left hand side of the form.


Data Filtering – User would be able to filter data in Views forms by clicking and selectin the Grid Headers. 


Charts – Charting feature would be available. See below:

Team Ownership – In CRM 4.0, entities were either owned by User or Organization. But in MS CRM 5.0 there will be Team Owned entities with role-based security model.

Native SharePoint Integration – There is an integration support with Windows SharePoint Services for document management. It includes site & document library provisioning, document metadata, item security, and check-in/check-out capabilities.

New Features for Administrators

Flexible Form Layout - We now have much more flexibility in how forms are laid out, for example, we can position sections side-by-side, as well as field labels on top, left or right of each field. Best of all, we can now configure "In-Line Sub-Grids" for child records, so a combination of IFrames & JScript is no longer required to make this work. 

Filtered Lookups - One of the most requested features has finally made it into the product. Whilst customizing the form, you can choose a pre-defined view or better still you can filter by a related lookup on the same form. 

Form Headers & Footers - Now that all tabs, sections and fields appear on a single, scrolling form, it is quite possible the form will get become quite long and you will end up scrolling up and down more often to find the information you require. In order to make the most commonly required visible at all times, you can now place these fields in a header or footer so that they will always be displayed regardless of the scrolling.

Solution Management - With CRM 4.0, you had to implement a manual process when customizing your solution, to make sure that you didn't overwrite previous customizations, or disrupt any 3rd party ISV solutions. In CRM5 we had now added the concept of solutions. 

A solution is a defined set of entity customizations, workflows, e-mail templates, security roles, plug-ins etc. that can be managed as a single unit. Each solution is version controlled so presumably your can have multiple versions of the same solution installed, and roll-back to a previous version if necessary. 
You can also define solution dependencies where one solution can only be installed if another solution is also installed. For example, you might have a base solution for your whole organisation, with a departmental specific solution built on top of it. 

Namespace collision is avoided by defining publishers, with each publisher having a unique namespace. This avoids the common issue where the default namespace "new_" is used for all customizations, leading to potential namespace conflicts. 
One final plus point is that you can now specify which attributes will be exported as part of a solution, rather than having no choice but to export the whole entity.

Multiple Option Sets - Otherwise known as "Global Picklists", you can define these at the solution level, and re-use them across multiple entities.

Drag & Drop Form Editor - One of the most time consuming customization tasks in CRM 4.0 is the form design. Every time you want to add, remove or re-position tabs, sections and attributes, you have to go through a multi-click process. With CRM5, you can now drag and drop all elements of a form, speeding up the process considerably 

Audit - Although not explicitly mentioned during the sessions, I spotted an "auditing" setting on the attribute designer form, allowing you to turn auditing on or off. 

New Features for Developers:

Custom Code Sandbox - There is a new server role for running custom plug-in code and custom workflow activities without requiring full trust. This means that it will be possible to run custom code in the CRM Online environment and achieve true parity between On-Premise, Partner-Hosted and Microsoft-Hosted deployments.

Plug-In Transaction Support - In CRM 4.0 you could register a plug-in to run either before (pre-event) or after (post-event) the CRM platform operation. However, you were not able to run as part of the transaction itself, so you had to right your own compensation logic in the event the CRM platform operation failed. CRM5 addresses this limitation, and you can now choose to register you plug-in as part of the platform operation. The CRM5 plug-in registration tool has been modified to support this. 

Automatic Plug-In Profiling - CRM5 will keep track of how a plug-in is executing, what resources it consumes, if it is causing unexpected exceptions and whether or not it is violating security constraints. If a particular plug-in fails a number of times it is automatically disabled from executing, helping to maintain system integrity.

I want to add here only that also the CRM Workflow side will be improved a lot and the WF usage will be extended.

Do you remember how many times we've asked the Team to have filtered lookups? So natural request I think... In CRM 5.0 we'll have this feature!!

I have also a personal request: I hope on improvements regarding data import and data migration. CRM 4.0 helps a lot on data migration but it's not always so easy to migrate large amount of data from a custom system to CRM (due to the import processes that sometimes are "freezing").


Some time back I saw these feature listing on Simon Hutson's post on MS CRM 5.0. Also for complete list of features with screen shots refer here also.

Monday, December 15, 2008

How to delete records from CRM web forms using javascript in MS CRM 4.0

function DeleteEntityRecord(entityName, attributes, orgName)
{
      //attributes = #accountid> 92384923 #/accountid>#firstname>harry#/firstname> ...
  var xmlString = "#?sXml version='1.0' encoding='utf-8'?>";
      xmlString +="#soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>";
      xmlString +="#soap:Header>#CrmAuthenticationToken xmlns='http://schemas.microsoft.com/crm/2007/WebServices'>";
      xmlString +="#AuthenticationType xmlns='http://schemas.microsoft.com/crm/2007/CoreTypes'>0#/AuthenticationType>";
      xmlString +="#OrganizationName xmlns='http://schemas.microsoft.com/crm/2007/CoreTypes'>" + orgName + "#/OrganizationName>";
      xmlString +="#CallerId xmlns='http://schemas.microsoft.com/crm/2007/CoreTypes'>00000000-0000-0000-0000-000000000000#/CallerId>";
      xmlString +="#/CrmAuthenticationToken>";
      xmlString +="#/soap:Header>";
      xmlString += " #soap:Body>" +
      xmlString +="   #Delete xmlns='http://schemas.microsoft.com/crm/2007/WebServices'>";
      xmlString +="     #entity xsi:type='" + entityName + "'>";
      xmlString +=  attributes;
      xmlString +="     #/entity>";
      xmlString +="   #/Delete>";
      xmlString +=" #/soap:Body>";
      xmlString +="#/soap:Envelope>";


      oXmlHttp.open("POST", "http://localhost/mscrmservices/2007/crmservice.asmx",false);
      oXmlHttp.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
      oXmlHttp.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/crm/2007/WebServices/Delete");
      oXmlHttp.send(sXml);
      
  var results = xmlHttpRequest.responseXML;
}

Please replace '#' with '<' after copying and before pasting..:)

How to update records from CRM web forms using javascript in MS CRM 4.0

function UpdateEntityRecord(entityName, attributes, orgName)
{
      //attributes = ?accountid> 92384923 ?/accountid>?firstname>harry?/firstname> ...
  var xmlString = "??sXml version='1.0' encoding='utf-8'?>";
      xmlString +="?soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>";
      xmlString +="?soap:Header>?CrmAuthenticationToken xmlns='http://schemas.microsoft.com/crm/2007/WebServices'>";
      xmlString +="?AuthenticationType xmlns='http://schemas.microsoft.com/crm/2007/CoreTypes'>0?/AuthenticationType>";
      xmlString +="?OrganizationName xmlns='http://schemas.microsoft.com/crm/2007/CoreTypes'>" + orgName + "?/OrganizationName>";
      xmlString +="?CallerId xmlns='http://schemas.microsoft.com/crm/2007/CoreTypes'>00000000-0000-0000-0000-000000000000?/CallerId>";
      xmlString +="?/CrmAuthenticationToken>";
      xmlString +="?/soap:Header>";
      xmlString += " ?soap:Body>" +
      xmlString +="   ?Update xmlns='http://schemas.microsoft.com/crm/2007/WebServices'>";
      xmlString +="     ?entity xsi:type='" + entityName + "'>";
      xmlString +=  attributes;
      xmlString +="     ?/entity>";
      xmlString +="   ?/Update>";
      xmlString +=" ?/soap:Body>";
      xmlString +="?/soap:Envelope>";


      oXmlHttp.open("POST", "http://localhost/mscrmservices/2007/crmservice.asmx",false);
      oXmlHttp.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
      oXmlHttp.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/crm/2007/WebServices/Update");
      oXmlHttp.send(sXml);
      
  var results = xmlHttpRequest.responseXML;
}

Please replace '?' with '<' after copying and before pasting..:)

How to avoid Mouse 'Right Click' Paste feature


function Disable_RightClick()
{
    if(event.button == 2)
    { 
        window.clipboardData.clearData();
        return false;
    }
}

crmForm.all.firstname.attachEvent("onmousedown",Disable_RightClick);

How to avoid Copy Paste in input fields

Here is a code to avaoid 'Ctrl+V' use by the users on field that you want to enforce double validation on:

function KeyPressed(e) 
  { 
    var evt = typeof window.event != 'undefined' ? window.event : e; 
    var val = evt.keyCode == 86; 
    if (evt.ctrlKey && val) 
    { alert(evt.ctrlKey +", "+ val);
      if (evt.stopPropagation) 
      { 
        evt.preventDefault(); 
        evt.stopPropagation(); 
      }
      else 
      { 
        evt.cancleBubble = true; 
        evt.returnValue = false; 
      } 
  } 
crmForm.all.firstname.attachEvent("onkeydown",KeyPressed);

How to disable save buttons on MS CRM form

Disable 'Save':
document.all._MBcrmFormSave.style.display='none'; 

Diable 'Save and Close':
document.all._MBcrmFormSaveAndClose.style.display='none'; 

Disable 'Save and New':
document.all._MBcrmFormSubmitCrmForm59truetruefalse.style.display='none'; 

Customize solutions to Duplicate Detection in MS CRM 3.0 and MS CRM 4.0

Hi Guys,

Here is a duplicate detection solution I have used so far.. can be implemented using MS CRM 3.0/4.0.

I know there are built-in features in MS CRM 4.0 for duplicate detection.. but if you are faced with a situation where user will decide whether to keep a duplicate record. And if the user want to view the already saved record.

There is a solution to this problem:

1. Validate in Javascript-Create a 'Duplicate Check' web application for search/view/modify/delete duplicate record. Call this web application from crm webform. On CRM webform you can put a button on the top of your entity's 'create form' by modifying isv.config file. Write code in a JS function to call this web application in the 'onload' event of the crm form. By placing code here, you have an advantage. User can manually make a search for duplicate record(s) and automatically from 'onsave' event also if you want to enforce strict 'duplicate check' business rule before saving a record. 

In this 'Duplicate Check' web application, you can provide functionality to compare already present multiple duplicate records with the new record. User can be provided with a feature of choosing which record to keep and which one(s) to delete or keep. Detail record viewing capability can also be provided by embedding a modified url (http://localhost/userdefined/edit.aspx?id={6EC5E8B5-E250-DD11-94EE-00188B7A5223}&etc=10007). Just change the GUID.


 

Saturday, December 13, 2008

A record with these values already exists. A duplicate record cannot be created. Select one or more unique values and try again.

Recently, I faced the problem of different MS CRM customization files on my Production and Staging servers. When I finished customization on Staging server, I was to upload this customization to Production for live environment. All plugins were deployed onto production system, but when I tried to upload the staging customization file to production it gave me an error "A record with these values already exists. A duplicate record cannot be created. Select one or more unique values and try again."  
This message started appearing because during my development stage my Project Manager created some views for entities directly on the production. So the 2 CRM systems went out of sync. We both tried alot of things to solve it, but all in vain. I also contacted Microsoft CRM help team(Customer Source), they suggested using CRM tracing tool.  

Finally, we used the tracing tool to monitor the uploading process on production system. We found out problems with a view. I removed that view production system and tried again. Again and again I removed many view from production system. Then only after removing all the views that were created after I copied the CRM system from production to staging, I was able to upload the customizations to Production system. 

Friday, December 12, 2008

Fetch XML query builder tool to retrieve data from MS CRM 4.0

This is a link to the MS CRM 4.0 Fetch XML Query Builder Tool.  

In order to install it you have to uninstall the previous version of this tool that was used to CRM verion 3.0. Then only this will get installed.  

You need a product key to use this tool. Its here..

Create fetch XML query using a simple tool for MS CRM 3.0

I have been working with MS CRM 3.0 now for more than an year. 
Faced alot of problem in .Net code and Javascript because I don't like to write code much code in either language. I always look for easy solutions for getting work done.

Have used alot of fetch XML queries in my MS CRM 3.0 implementions. I always difficult to write javascript code in MS CRM environment. By chance I got a link to Fetch XML query builder tool. This is an incredible tool to be used in .Net code plugins for retrieving  records from MS CRM database.
 
After install you need a key to unlock this tool and use it: Request Key

How to dynamically create querystring for a webform call..

I face this problem of making calls to web application and generating dynamic content based on the record selected by the user in CRM.

I created a button on the form. I had a constant url for the web form. I had to extract the qurystring value from the form data values. But special characters and
few manipulation is allowed in the isv.config file. So I created javascript methods in the 'onload' event method of form. 

In isv.config file:
Added Button to the Entity
added "JavaScript="SearchDetails();" attribute of the Button  

function SearchDetails()
{
.. implentation here
.. built dynamic url and made call to web application
}   

Monday, December 1, 2008

MS CRM 3.0/4.0 Form how to's

'Form' How to Tips:

 

1.   Change Field Required level: 

crmForm.SetFieldReqLevel( "" , true );  


2.  Check if the form has changed or not after it was loaded:

alert ( crmForm.IsDirty() );  



3.   How to bind javsscript event to form and controls:

for form - crmForm.attachEvent( "onsave" ,  methodName );  

for control – crmForm.all..attachEvent( "onclick/onblur/…" ,  methodName );  


4.   How to get Entity Object Type Code

alert(crmForm.ObjectTypeCode);  



5.   How to Retrieve Entity Schema Name

alert(crmForm.ObjectTypeName);  



6.   How to avoid dialog box that appears on the webform some times when u try to close the form

crmForm.detachCloseAlert();