Posts

Showing posts from October, 2016

“Pause until Date” workflows handle changing dates

Image
SharePoint workflow update 'pause until date' when item is updated In some cases we need to update the 'pause until date' dynamically from the SharePoint designer workflow. In my case I have a list, that contains Expire Date. I need to send remainder before 7 days. But here there is a difficulty, suppose users update the 'Expire date' then 'Remainder date'(ie workflow 'pause until date') also get updated in workflow. But SharePoint workflow will not start if there is a running workflow instance for that item. It is difficult to stop the running workflow OR update the pause until date' while it is running. To handle this scenario we can use SharePoint 2013 workflow. SharePoint 2013 workflow contains a new feature called 'Loop'. We can use this loop until our condition satisfied. So that we can update the 'pause until date' inside the loop dynamically. To test this workflow we can log some test messages inside the w...

jquery callback methods for asynchronous loop to finish

Some times jquery loop statement will not wait until the ajax call completion. For this case we can use the jquery callback method for looping ajax calls. In the below example arrayValue is passed into a call back function. this function will  be executed until we call the 'callback()' (which is called in the else part). we need to write this function inside a function. function parentFunction() { var deferred = $.Deferred(); (function Task(i,callback) { if(i<arrayValue.length) {  /*your code here*/ var temp = yourFunctionCall(arrayValue[i]);  temp.done(function() { Task(i+1,callback) }) } else { //this call will terminate the function callback(); } }) (0,function(){alert('Completed');deferred.resolve();}); return deferred.promise();  } Please refer the following links for more details  Link1  ,  Link2

Get all user names instead of User ID from a List using Rest API SharePoint 2013

Use the below code to get user name directly from a list instead of getting a user ID. Using $expand OData operator you can specify that the request returns projected fields from other lists and the values of lookups. function getAllUserNames() { var deferred = $.Deferred(); var arrayContractOwner = new Array(); // this array to get all user names from list     var serverUrl = _spPageContextInfo.webAbsoluteUrl;     var ListNameUrl = String.format("{0}/_api/web/lists/getbytitle('ListName')/items?$select=UserColumnName/Name,UserColumnName/Title&$expand=UserColumnName/Id",serverUrl);                       $.ajax({                     url: ListNameUrl,                     type: "GET",                     headers: {"Accept": "application/json;odata=...