Date Time Duration between two field.
*Note duration field is in decimal type. That mean the calculation can calculate until decimal point. At here u can set the amount of decimal point u want to see at the field.
Javascript Eg.
function getAging() {
var Answer = 0;
var AgingStartTime = Xrm.Page.data.entity.attributes.get("FieldName").getValue();
var AgingEndTime = Xrm.Page.data.entity.attributes.get("FieldName").getValue();
if (AgingStartTime != null) {
//Date time duration different between today and AgingStartTime
var today = new Date();
Answer = (today - AgingStartTime) / 1000 / 60 / 60 / 24;
//Date time duration different between AgingStartTime and AgingEndTime
Answer = (
AgingStartTime -
AgingEndTime ) / 1000 / 60 / 60 / 24;
}
else { Answer = null; }
//Which field to put the answer record to.
Xrm.Page.data.entity.attributes.get("FieldName").setValue(Answer);
}
End.
CRM 2011 Date Time Duration
Posted by Unknown at 6/28/2012 05:12:00 pm
Labels: CRM 2011
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment