Tuesday, December 3, 2013

Windows - How to delete a service which is no longer used?

There can be scenarios where we have some services in the server which is no longer used. In such a scenario its better to delete the same.

For that what you can do is,
  1. Open the command prompt as administrator.
  2. Type the command sc delete <service name>
  3. Enter
The service is deleted from the list.

There are other options to do the same. But the above one helped me to delete the same. If you need to go for other options for any reasons please check here.

Hope this helped you.

Monday, November 25, 2013

CRM 2011 - Script loading to Client

What I understood was wrong from UR12 for CRM 2011. JScripts mentioned in the forms in a specific order was not loaded to the client in the same order. Its loaded in the order in which the same is received from the server.

There is no guarantee that the dependent scripts mentioned in the form may be loaded after the script which is calling the same.

Thanks scott for this wonderful post.

CRM 2011 - Hide the footer from notes in different entities

Different entities have the notes in the form where the user can add, delete notes and also attach files. If the users are not giving proper titles for these notes then we could see that when notes are created there will be redundant data in the title and footer of the note, which is the name of the owner and the date when the note was created.
 
This can be fixed, if required in two ways one way is to educate the users to give a proper title so that the redundant data can be removed. Second way is to hide the footer where the same data is displayed again.
 
Second way is not a supported way in CRM 2011. But we can do this. This has some disadvantages though.
 
This can be implemented only (as per my knowledge, please let me know otherwise) when the form loads as the notes attribute cannot be modified or we cannot add any on change event for the same attribute. Because of which when the user adds a new note the footer will be visible for the new note and when the user deletes an existing note then all the hidden rows will be visible again. This will last until the form is reloaded so that our code is triggered.
 
Below is the code which I used to hide the row
 
function HideNotesFooter() {
//Get the iframe which has the table row which needs to be hided.
var iframe = window.document.getElementById('notescontrol');
//Get the inner document from the iframe object.
var innerDoc = iframe.contentDocument || iframe.contentWindow.document;
//Get the list of all elements inside the iframe having the class name 'noteHeader'
var noteHeader = innerDoc.getElementsByClassName('noteHeader');
//Checks whether the noteheader contains any element or not. If it doesnt have any element trigger this function after sometime.
if (noteHeader.length == 0) {
setTimeout(DisableNotes, 1000);
} //End if for length
else { //If it has any element loop through them and hide the respective row from the table.
for (i = 0; i < noteHeader.length; i++) {
if (i % 2 != 0) {
noteHeader[i].style.visibility = 'hidden';
} //End if for modulus
} //End for loop
} //End else
} //Function End
 
I have used a call to the setTimeout function because some time I could see that the rows to be hided were not available when the script execution was happening.
 
Hope this helped you.

Tuesday, November 5, 2013

JavaScript Errors

When our script attempts to perform an action that the system cannot execute a run time error occurs. It will be easy if we can identify the same from the number returned so that a meaningful user friendly message can be passed on to the end user.
Similar is the case for the syntax errors.
Below is the link to msdn site which will give a fair idea on these error numbers and the description.
For Runtime error check here.
For Syntax errors check here.

Friday, October 18, 2013

CRM 2011 - Getting entity name and Id using Javascript

There are different ways to get the entity information from the form using JScript.
 
Let's say we need to get the information from within the form ribbon. We can get it with a simple statement as below,
 
var entityName=Xrm.Page.data.entity.getEntityName();
 
This will return the logical name of the entity for the record. For example, if the record is a contact this will return "contact".
 
If we need to get the entity name from the Homepage ribbon, then we have to do it in another way. Follow the below steps to achieve this,
  1. In the javascript add a parameter to accept this and pass the crmParameter "SelectedControlSelectedItemReferences"
  2. This will get us the below details, the JScript code would be like this.

function GetDetails(selectedControlSelectedItemRefernces)
{
   var Id = selectedControlSelectedItemRefernces[0].Id;
   var Name = selectedControlSelectedItemRefernces[0].Name;
   var TypeCode = selectedControlSelectedItemRefernces[0].TypeCode;
  var TypeName = selectedControlSelectedItemRefernces[0].TypeName;
}

If the user has selected multiple records in the grid then loop the "selectedControlSelectedItemRefernces" object and get the records one after the other.

If you are using ribbon editor you can refer to this blog for a step by step process how to achieve this.

Within the form if we need to get the Id of the record then it is a straight way process,

var recordId = Xrm.Page.data.entity.getId();

This will return a GUID value for the record.

Wednesday, August 14, 2013

CRM 2011 - Plugins - Isolations,Trust & Statistics

In CRM 2011 we can register a plugin in two ways, either within the sandbox (an isolated environment) or outside the sandbox.
 
Termed as partial trust or full trust the features for each of these approaches are as follows,

Partial Trust Full Trust
Within the sandbox Outside the sandbox
For online deployment, plugins should be registered this way. Supported for on premises and Internet Facing Deployments

Advantages of using the isolated mode would be,
  1. Security
  2. Supports runtime monitoring
  3. Statistics Reporting
  4. Supported for all deployments.
One thing to be noted here is that the online deployment of CRM supports custom workflow activities only if the same is registered in sandbox or isolated environment.
 
With all these advantages, the drawback if the plugin is registered in isolated environment is that Access to file system, system event log, certain network protocols, registry and more is prevented in the sandbox. Only exception to this is that it has access to external endpoints like azure.
 
Available statistics on plugin and custom work flow activities is available in the entity PluginTypeStatistic entity. This information can be collected using the request and response messages. These information will be available within 30 minutes to 1 hour after the execution of plugin or custom work flow.

CRM 2011 - Documentation in a single location

Everyone of us might have downloaded the CRM 2011 documentation for our reference to our local machines.
 
If not yet and worrying where all the documentation can be found don't worry, the answer is here.
 
Please follow the below link  below and it will redirect you to a post from the CRM Dynamics community with the link available for different kind of documentation available.
 
Should really appreciate Jarrod Williams for this. Thanks Williams !!!
 
 
When I found this thought of worth sharing with everyone of you. Hope this helped you !!!

Configuration for CRM Plugins

CRM plugins are always great feature where we can automate many functionality which we cannot automate from user interface. But almost eve...