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

Form html buttons plus js to calculate time stamps

$
0
0

Hello All,

I've got two buttons as HTML web resources on my form one for start and the second for Stop like so:

<html>
<head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> 
	<title></title> 
<meta><meta><meta>
</head> 
<body style='word-wrap: break-word;'> 
	<button type='button' onclick='parent.setTimeStamp();'>Start</button>
</body>
</html>


Once the user click the start/stop buttons the js function below is being called to set
two added text fields (new_StartTimeStamp / new_StopTimeStamp) respectively to capture time stamps:


function setTimeStamp() {
var currentDateTime = new Date().getTime(); 
Xrm.Page.getAttribute("new_StartTimeStamp").setValue(currentDateTime);
}

I get an error when my form is loading referring me to my custom script.
In addition to what I mentioned above, part of the functionality I'm trying to establish, is to calculate 
the difference between the two fields and set it as value of another field (new_timeStampCalc).

For example: start time stamp records 14:45 and stop time stamp records 14:57.
new_timeStampCalc will be 0:12.
 Thank you,

Viewing all articles
Browse latest Browse all 46379

Trending Articles



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