CRM 2011 – Javascript to set the current date and time
Views (12900)
A quick blog entry and a suprisingly easy and small piece of code
In the code below I have function which gets triggered when a user ticks the confirm Closed checkbox it then sets the current date and time.
if the user untick the checkbox I wipe the date and time value.
The date functionality in javascript holds the current time as well
function confirmClosedOnChange() {
var closedConfirmed = Xrm.Page.getAttribute("new_closedconfirmed").getValue()
if (closedConfirmed) {
var currentDateTime = new Date();
Xrm.Page.getAttribute("new_confirmedcloseddate").setValue(currentDateTime);
} else {
Xrm.Page.getAttribute("new_confirmedcloseddate").setValue(null);
}
}
Filed under: CRM 2011, Javascript, JScript
This was originally posted here.

Like
Report
*This post is locked for comments