You need to sign in to do that
Don't have an account?
Gauri Kasat 8
i need to take location after specific interval of time till the end time
Hello..
My requirement is to take location from user say after every 1 hours and the end time is 2 hours.
how to do this?
var initDate = new Date(); // Or get the user login date from an HTML element (i.e. hidden input)
var interval;
interval = window.setInterval(function() {
var now = new Date();
if(hours=='' || hours==null || hours ==undefined){
getLocations();
}else{
if(now.getTime() - initDate.getTime() < hours*60*60*1000 && now.getDate() == initDate.getDate()) {
getLocations();
}
else {
stopJourney();
window.clearInterval(interval);
toggleAdjustment();
checkInToggle();
toggleAdjustment();
var element1 = document.getElementById("stopInactive");
element1.classList.toggle("clsHide");
var element2 = document.getElementById("stop");
element2.classList.toggle("clsHide");
}
}
}, intervalInMinutes*60*60*1000);
});
Note: value of "hours" varaible : 2
value of "intervalInMinutes" : 1
My requirement is to take location from user say after every 1 hours and the end time is 2 hours.
how to do this?
var initDate = new Date(); // Or get the user login date from an HTML element (i.e. hidden input)
var interval;
interval = window.setInterval(function() {
var now = new Date();
if(hours=='' || hours==null || hours ==undefined){
getLocations();
}else{
if(now.getTime() - initDate.getTime() < hours*60*60*1000 && now.getDate() == initDate.getDate()) {
getLocations();
}
else {
stopJourney();
window.clearInterval(interval);
toggleAdjustment();
checkInToggle();
toggleAdjustment();
var element1 = document.getElementById("stopInactive");
element1.classList.toggle("clsHide");
var element2 = document.getElementById("stop");
element2.classList.toggle("clsHide");
}
}
}, intervalInMinutes*60*60*1000);
});
Note: value of "hours" varaible : 2
value of "intervalInMinutes" : 1
You will get location of user with the below code in your visualforce page.
You can schedule this feature with Schedulable interface in salesforce, Through that you can call this method or you can specify in which time and the mehod will work when that time comes.
Regards
Ajvad Aju