RSH
RSH

Reputation: 1

Default time stamp when creating a phone call in CRM 2011

When creating an activity in CRM 2011 (specifically a phone call), the time defaults to 12AM and one has to manually change this (unless you actually plan to call at midnight). Anyone know how to change this to something else, say 8:00am?

Upvotes: 0

Views: 513

Answers (2)

Guido Preite
Guido Preite

Reputation: 15128

you can use this code inside the OnLoad event:

if (Xrm.Page.ui.getFormType() == 1) {
    var today = new Date();
    var hours = 8;
    var minutes = 0;
    var seconds = 0;

    var newTime = new Date(today.getFullYear(), today.getMonth(), today.getDate(), hours, minutes, seconds);
    Xrm.Page.getAttribute("scheduledend").setValue(newTime);
}

Upvotes: 3

Daryl
Daryl

Reputation: 18895

User Javascript. Add an OnChange Event handler to the field that calls this:

Xrm.Page.data.entity.setValue("scheduledstart", time);

where time is the time that you want to set it to.

Upvotes: 0

Related Questions