Archive

Archive for the ‘CRM 4.0’ Category

Email format validation in CRM

October 27, 2011 1 comment

Hi,

The out of the box CRM Email field type does not validate whether the given email is ending with “.com”,”.in”,etc… (Refer below)

  • rajeevpentyala@live  (Its a valid email format as per out of the box CRM Email Type validation)

We can validate all the metrics of Email format by using below steps.

Step 1:-

  • Create a new “Field” (i.e.,new_emailaddress1) of type nvarchar(100)
  • Since the field is normal field, we have to format the field to look like “Email”
  • Place below script in form ‘onload’ event

    var emailTextBox = crmForm.all.new_emailaddress1;

//Set the field style similar to ‘Email’ (i.e., Blue forecolor and Underline)
emailTextBox.style.color = “#0000ff”;
emailTextBox.style.textDecoration = “underline”;

//Attach ‘on double click’ event
emailTextBox.attachEvent(“ondblclick”, openEmail);
function openEmail() { if (emailTextBox.DataValue != null) document.location = “mailto:” + emailTextBox.DataValue; }

Step 2 (Email Validation) :-

  • We can validate email format either in form’s ‘onsave’ event (or) field’s ‘onchange’ event
  • Register below function as per your requirement (i.e.,Either in ‘onsave’ or ‘onchange’)

function ValidateEmail() {
var emailID = crmForm.all.emailaddress1.DataValue;

if ((emailID.indexOf(“@”) > 0 && (emailID.lastIndexOf(“@”) != (emailID.length – 1))) || (1 == 1)) {
if (emailID.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1) {
}
else {
alert(“You must enter a valid e-mail address.”);
crmForm.all.emailaddress1.SetFocus();
event.returnValue = false;
}
}
}

Hope it helps 🙂

Advertisement

Set field values using query string parameters on Form load in CRM

October 11, 2011 Leave a comment

Hi,

I have got below requirement,

  •  I need to open a CRM form from my custom ‘.aspx’ page.
  • On opening of the form I should populate “name” field with value

After referring MSDN article, I came to know that we can set the field values using “extraqs” query string parameter and it must meet below requirements.

  • You must encode the parameters passed in the extraqs parameter. Use encodeURIComponent to encode the parameters.
  • The names of the query string arguments must match or include the names of attributes for the entity.
  • The value cannot be a script (To prevent script injection)

Below is the sample JScript to open a form and populate “name” field on form load

function openform() {
var encodedString = encodeURIComponent(“new_name=rajeev pentyala”);
window.open(“http://ServerName/OrgName/main.aspx?etc=10014&extraqs=” + encodedString + “&pagetype=entityrecord”);
}

  • Here “new_name” is the name of attribute

You get the CRM form as below, when you call the above function

extraqs query parameter

extraqs query parameter

Please refer below useful MSDN articles

Hope it helps 🙂

Missing prvReadAsyncOperation privilege exception

September 21, 2011 3 comments

Hi,

Today my plug-in has thrown “Missing prvReadAsyncOperation privilege ” exception for user with one of the security role.

Fix:-

  • We need to grant Read Priveliege of System Job for the security role
  • Open the Security Role and go to Customization tab
  • Refer below screen
prvreadasync-privilage

prvreadasync-privilage

 

Hope it helps 🙂

How to change CRM form field’s label text and color using Jscript

September 15, 2011 1 comment

Hi,

Below is the sample JScript to change the color and text of  CRM form field’s  label; Place the code in JScript “onload” event

// To change color

if(crmForm.all.new_fieldname != null) {

var field = crmForm.all.new_fieldname_c; //”_c” is the caption (i.e.,Label)

if (field != null)

field.style.color = ‘gray’; //Specify your desired color

}

Same script work for both CRM 4.0 & CRM 2011

// To set the label

Xrm.Page.ui.controls.get(fieldname).setLabel(‘New label’);

🙂

How to verify the log files for CRM installation issues

  • Open “Run” window (Ctrl+R)
  • Type “%APPDATA%\Microsoft\MSCRM\Logs\
  • You find the list of generated logs
  • Sort by “Last Modified Time” to get the latest .log file

Issues while installing CRM 4.0 on Windows Server 2008 R2

Errors Screen

While installing CRM 4.0 on Windows Server 2008 R2 server we  will get errors mentioned in above screen

1)    To fix the issue  “Service cisvc was not found on computer XYZ”

Reason:-

  • This is because CRM 4.0 requires the old “Indexing  Service (CISVC)” , which was part of Windows Server 2003

       Fix:-

To fix this,  we need to enable the Windows Server 2003 indexing service (cisvc) on current Windows  Server 2008 machine within File Server Role. (Follow below steps)

Enabling CISVC Indexing Service

  • Open “Server Manager”
  • Click on “Roles” link
  • Go to “File Server Role” tab and click on  “Add Roles” link
  • Check “Indexing Service” under “Windows Server 2003 File Services”

2)    To fix the “Service  msftesql was not found”

Reason: –

  • This error comes from conflict between installing Microsoft Dynamics CRM 4.0 with SQL Server 2008.
  • The “msftesql” is the “Microsoft SQL Server Full  Text Indexing Service” which has a different name under SQL Server 2008

Fix:-

  • Open “Registry” (Go to Run -> Regedit)
  • Navigate to “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services” on the tree
  • Rename ‘MSSQLFDLauncher’ Folder to ‘msftesql’
  • Restart the server
  • Go to “Services” (Run ->  Services.msc)
  • Start the “SQL Full-text Filter Daemon  Launcher (MSSQLSERVER)” service
  • Complete the CRM installation
  • Rename back msftesql Folder to  MSSQLFDLauncher (Follow step 1 – 3) 

3)    To fix the “Index was  outside the bounds of the array”

  • Configure “User  Account” which you have given while installing CRM  as service account for Report Server and  Analysis server
  • Instead of  above step, You can even give “Network Service Account” as service account  while installation