Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 55831

Regarding Date fields in mscrm 2015

$
0
0

Hi,

I have two date fields in my CRM named as Start Date and End Date and one text field named as Term.

I should get the difference between the End date and start date and the result should populate in the term text  field.

The result should be like Days/Months/Years and the filed should be read only.

                       

function Calculate() {
    var actualStartObj = Xrm.Page.data.entity.attributes.get("new_startdate");
    var actualEndObj = Xrm.Page.data.entity.attributes.get("new_enddate");
    var durationinMinutesObj =Xrm.Page.getAttribute("new_term").getValue()
    if (Xrm.Page.getAttribute("new_startdate").getValue() != null && Xrm.Page.getAttribute("new_enddate").getValue() != null && Xrm.Page.getAttribute("new_term").getValue() == null)
 {

        var dateDifference = Math.abs(actualEndObj - actualStartObj);
        var durationInMinutes = Math.floor((dateDifference / 1000) / 60);

       durationinMinutesObj.setValue(durationInMinutes);
}
}

I have written the code as above,but it is not working as expected.Please help me out.


Viewing all articles
Browse latest Browse all 55831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>