Monday, March 30, 2015

New features in CRM 2015 Spring Release

Below is a link to the article that explains about the new features that was released for CRM 2015 spring release.
Hope it is useful for someone :)
http://www.microsoft.com/en-us/dynamics/crm-customer-center/what-s-new.aspx


Happy CRMing :)

Wednesday, September 10, 2014

Validate a CRM field Data

//You can do it in both ways, onChange or onSave.






//For OnSave

//Keep it in the OnSave


function Validate(execObj)//Pass Execution Object from Form Editor



{

var optionSetValue=Xrm.Page.getAttribute("fieldName").getValue();

if(optionSetValue==330760000)



{

alert('Please Select value for field name');



execObj.getEventArgs().preventDefault();

}

}

//For Onchange

//Keep it in the OnChange


function Validate()



{

var optionSetValue=Xrm.Page.getAttribute("fieldName").getValue();

if(optionSetValue==330760000)



{

alert('Please Select value for field name');

Xrm.Page.getAttribute("fieldName").setValue(null);



}

}

 

Tuesday, January 29, 2013

System Jobs in Waiting State CRM 4.0

We had a strange issue with one of our client, all the system jobs created are going to waiting state. Event logs doesn't have much details on the error. So i have enabled Trace on the CRM server using CRM 4 diagnostic tool.
The logs had some Error entries and the error message says
"System.Net.WebException: The request failed with HTTP status 404: Not Found."

I did some search on the above error message found some links where they suggest that the Async service is pointing to some wrong CRM Service URL.

The Async service points to CRM Service using the settings in a table called DeploymentProperties in MSCRM_CONFIG database.

The value for the field "AsyncSDKRootDomain" is blank in DeploymentProperties and i have updated the record with the value <CRMSERVER>:<PORT>.
Sql Script:
update deploymentproperties set NVarcharColumn='<CRMSERVER>:<PORT>' where columnname='AsyncSDKRootDomain'

This fixed the issue and system jobs started working.


Happy coding.

Wednesday, May 30, 2012

CRM 2011 Developer Toolkit

The Developer Toolkit for CRM 2011 allows the developers to do customizations, create new web resources,write plugins and workflows etc from Visual Studio. You can also deploy your code changes from VS itself.
A great tool which allows lot of development to be done from Visual Studio, no need to open CRM Web client, plugin registration tool etc.
A detailed blog is here from Daniel Cai on how to use it.

Friday, May 18, 2012

CRM 2011 Ribbon Editor

Below is a link to the Visual Ribbon Editor which is very easy to use for editing ribbon in CRM 2011. http://crmvisualribbonedit.codeplex.com

Friday, July 29, 2011

Duplicate Detection Rule in CRM

Hi,

I am investigating how the duplicate detection rules are working in CRM for an assignment, so far i understand the below points and need help in understanding additional details.

1. Everytime when you create a duplicate detection rule a record is created in duplicaterule entity.It Contains the details of Base entity,matching entity and matchcodetable etc.

2. The details of the attribues on which the rule was made are stored in duplicaterulecondition, so it may contain multiple record for each rule storing the attribue details and the condition.

3. The matchcodetable contains the matchcodes for each of the entity record using the above duplicate rule.

So far everything is fine for me, but i didnt understand how the order of the fields are used to generate matchcodes.

For example: i have created a rule saying firstname and lastname exact match.

For the record,

Firstname : jeevan

lastname: balija

middlename: kumar

city: hyd

it created a matchcode as "balija[sep]jeevan"

Then i modified it to add middlename also at the end of the rule, it updated the matchcode as

"kumar[sep]jeevan[sep]balija"

added one more field city to the rule, then it updated the matchcode as

"kumar[sep]jeevan[sep]balija[sep]hyd"

So it is difficult to understand how the order of the fields are used.

I am trying to use this built in matchcode logic for our custom import project to avoid duplicates.
Any ideas,please post a comment.

Code snippets for future Reference

Hi,
Below are some of the code snippets for CRM 2011, i wanted to write in my blog for future reference or if someone needs they can also refer.

Below are some of the commonly used JavaScript code snippets. I have taken them from this blog

Get the value from a CRM field
var varMyValue = Xrm.Page.getAttribute(“CRMFieldSchemaName”).getValue() ;

Set the value of a CRM field
Xrm.Page.getAttribute(“CRMFieldSchemaName”).setValue(‘My New Value’);

Hide/Show a tab/section
Xrm.Page.ui.tabs.get(5).SetVisible(false);
Xrm.Page.ui.tabs.get(5).SetVisible(true);

Call the onchange event of a field
Xrm.Page.getAttribute(“CRMFieldSchemaName”).fireOnChange();

Get the selected value of picklist
Xrm.Page.getAttribute(“CRMFieldSchemaName”).getSelectedOption().text;

Set the requirement level
Xrm.Page.getAttribute(“CRMFieldSchemaName”).setRequiredLevel(“none”);
Xrm.Page.getAttribute(“CRMFieldSchemaName”).setRequiredLevel(“required”);
Xrm.Page.getAttribute(“CRMFieldSchemaName”).setRequiredLevel(“recommended”);

Set the focus to a field
Xrm.Page.getControl(“CRMFieldSchemaName”).setFocus(true);

Stop an on save event
event.returnValue = false;

Return array of strings of users security role GUIDs:
Xrm.Page.context.getUserRoles()

Hide/Show Tabs and Sections

function setVisibleTabSection(tabname, sectionname, show) {
var tab = Xrm.Page.ui.tabs.get(tabname);
if (tab != null) {
if (sectionname == null)
tab.setVisible(show);
else {
var section = tab.sections.get(sectionname);
if (section != null) {
section.setVisible(show);
if (show)
tab.setVisible(show);
}
}
}
}


Code to check whether the currently logged in User is a System Administrator

if (typeof (SDK) == "undefined")
{ SDK = {}; }
// Create Namespace container for functions in this library;
SDK.ContextSamples = {
isUserSysAdmin: function ()
{
var serverUrl = Xrm.Page.context.getServerUrl();
var query = "/XRMServices/2011/OrganizationData.svc/RoleSet?$top=1&$filter=Name eq

'System Administrator'&$select=RoleId";
var retrieveRoleRequest = new XMLHttpRequest();
retrieveRoleRequest.open("GET", serverUrl + query, true);
retrieveRoleRequest.onreadystatechange = function ()
{
SDK.ContextSamples.retrieveRoleResponse(this);
};
retrieveRoleRequest.send();
},
retrieveRoleResponse: function (retrieveRoleRequest)
{
if (retrieveRoleRequest.readyState == 4)
{
if (retrieveRoleRequest.status == 200)
{
var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.6.0")
xmlDoc.async = false;
xmlDoc.loadXML(retrieveRoleRequest.responseText);
var sysAdminRoleId = xmlDoc.selectSingleNode("//*[local-name() =

'RoleId']").text

var currentUserRoles = Xrm.Page.context.getUserRoles();

for (var i = 0; i < currentUserRoles.length; i++) { var userRole = currentUserRoles[i]; if (userRole == sysAdminRoleId) { alert("The current user has the 'System Administrator' role."); return; } } alert("The current user does not have the 'System Administrator' role."); } else { //handle error alert("Error retrieving user Roles"); } } }, };