Friday, December 23, 2011

Date Comparision in MS CRM 2011, usnig javascript

Just use the below code and use your date attribute name.
here am chacking for DOB should not be future date.

    var stringDateValue = Xrm.Page.data.entity.attributes.get("<attributeName").getValue().toString();
    var strOfBirth = stringDateValue.replace("UTC+0800","");
    var dateOfBirth = new Date(strOfBirth );
    var currentDate = new Date();
    if(dateOfBirth > currentDate){
        alert("Date of Birth can not be Future Date.");
        return;
    }

thanks,
yes.sudhanshu

No comments:

Post a Comment