
上QQ阅读APP看书,第一时间看更新
How to do it...
- Navigate to Settings | Solutions | Packt.
- Click on Web Resources and double-click on packt_common.js.
- Click on Text Edit and change the populateWithTodaysDate code to the following:
packtNs.common.populateWithTodaysDate = function(attributeToMonitor, dateAttributeToChange)
{
if (Xrm.Page.getAttribute(attributeToMonitor).getValue() !== null &&
Xrm.Page.getAttribute(dateAttributeToChange).getValue() === null)
{
Xrm.Page.getAttribute(dateAttributeToChange).setValue(
new Date());
}
}
- Add the following function:
packtNs.common.wireOnChangeEvents =
function(eventAttributeTuples){
for (var i in eventAttributeTuples) {
Xrm.Page.getAttribute(eventAttributeTuples[i].attribute)
.addOnChange(eventAttributeTuples[i].function);
}
}
- Replace the loadEvent function with the following code:
packtNs.graduateForm.loadEvent = function(){
packtNs.common.wireOnChangeEvents([
{attribute: "packt_supervisor",
function:
packtNs.common.populateWithTodaysDate("packt_supervisor",
"packt_postgraduatestartdate")
}
]);
}
- Click on OK, followed by PUBLISH, and then close the dialog.