TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Payal Banerjee
NA
11
656
How to compare current date with ModifiedDate in SPlist
Jan 21 2016 1:27 AM
I am looking for a solution :
Only for if condition to read first row's modified date and compare it current date [ ex today =21/01/2016 ]
condition :
if [ first row's Modified date == current date (Today)]
{
I have to do nothing
}
else
{
I will run my existing javascript to update all items
}
Javascript :
var clientContext = null;
var globalCount = 0;
var itemCountList = 0;
var curentDate = new Date();
function uploadDest(){
clientContext = new SP.ClientContext("");
oList = clientContext.get_web().get_lists().getByTitle("");
camlQuery1 = new SP.CamlQuery();
query1 ='<View></View>';
camlQuery1.set_viewXml(query1);
this.collListItems1 = oList.getItems(camlQuery1);
clientContext.load(collListItems1);
clientContext.executeQueryAsync(Function.createDelegate(this, this.onMultiSelectListDataLoadQuerySucceeded1), Function.createDelegate(this, this.onMultiSelectListDataLoadQueryFailed));
}
function onMultiSelectListDataLoadQuerySucceeded1(sender, args){
listItemEnumerator1 = collListItems1.getEnumerator();
itemCountList = collListItems1.get_count();
while (listItemEnumerator1.moveNext()) {
oListItem1 = listItemEnumerator1.get_current();
oListItem1.update();
clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
}
}
function onMultiSelectListDataLoadQueryFailed(){
alert("error occured");
}
function onQuerySucceeded() {
globalCount = globalCount + 1;
console.log("success / "+ globalCount + "/" + itemCountList);
if(globalCount==itemCountList){
localStorage.setItem("code","1");
window.location = document.location.href;
location.reload();
}
}
function onQueryFailed(sender, args) {
console.log("error");
}
if(localStorage.getItem("code") === null){
ExecuteOrDelayUntilScriptLoaded(function(){
var div = document.getElementById("WebPartWPQ2");
div.style.opacity = 0;
uploadDest();
},"sp.js");
}else{
localStorage.removeItem("code");
}
}
</script>
Reply
Answers (
5
)
ShaprePoint 2013 schedule email workflow
After hiding the sharepoint my scroll bar is missing