• SVS Solutions
  • NEWBIE
  • 35 Points
  • Member since 2014

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 5
    Replies
Hi All 
I am trying to write a utility method to get only the weekdays. Is there any easy way out. here is my code so far.  The return is in the form "09/16/2014 - Tue". I just need the Date. 

public class Utility_WorkingDays {
	
	public  List<String> getHeadDates(){
        List<String> formattedDates = new List<String>();
		List<DateTime> headDates = new List<DateTime>();
		DateTime currentDate = DateTime.now();
		//Date currentDate = currentDateTime.Date;
		for (Integer idx=0; idx<28; idx++){
        	headDates.add(currentDate+idx);
	    } 
	    for(DateTime dt: headDates){
	    	String formatDatewithDay = dt.format('MM/dd/yyyy - E');
	    	formattedDates.add(formatDatewithDay);
    	   	for(Integer i = 0; i< formattedDates.size();i++){
	        	String weekend = formattedDates.get(i);
	        	system.debug('here :'+weekend);
	        	if(weekend.contains('Sun') || weekend.contains('Sat')){
	        		
	        		formattedDates.remove(i);
	        	}
        }
	      
	    }
	    system.debug('dates:'+formattedDates);
		return formattedDates;
	}
}


Hi All,

We want to send out email alert when certain key words (like legal, tax) are mentioned in Chatter post. We notice Feed Item Trigger, can we use that to achieve this and how? Based on our research it seems Feed Item Trigger is for insert/delete post, can it trigger to send out email alert or create a new record? Ideally it can trigger to send out email alert, if not we're thinking to create a process like this, when someone mentions "legal" in the post, trigger will fire to create a record under a custom object we build and subsequently send out email alert by workflow rule. Any suggestions? Thanks.
I'm trying download, locally, all of our Tasks.  We have over 3.5 million tasks.  I'm using the SOAP API to download these (ALL ROWS).  I'm having trouble with query timeouts so I'm going to download in batches.  I've looked over the documentation and I'm trying my best to rely on the standard indexes.

I'm only relying on the Id field to help order and define my batches.  Right now I'm tyring to find the largest batch size that will use the Index and not produce timeouts.  So, imagine I've downloaded the first 99,999 Tasks. That limit was NOT chose arbitrarilly.  There is SF documentation (http://www.salesforce.com/docs/en/cce/ldv_deployments/salesforce_large_data_volumes_bp.pdf) stating an index will typically be used if you limit your records to under 100,000 rows.

Select Id from Task Order By Id ASC Limit 99999

Then, I look at the last Task.Id downloaded and get all Tasks greater than that one (sort order is important here).

Select Id from Task Where Id > '00T7000000cr8SzEAI' Order By Id ASC Limit 24999

I'd then repeat this until I've downloaded all my tasks.  I cant' understand why these subsequent queries cannot use the 99,999 limit.  24,999 is as large as I can go.  If I enter 25,000, it will NOT use the Index and instead timeout after attempting a full table scan.  I realize the differnece between the first and second query is the 'where' clause, but I still thought the index would be used if we were returning < 30% of the first million records.  Is this 25,000 limit some undocumented characteristic of the query optimizer?  The Query Optimizer (https://help.salesforce.com/apex/HTViewSolution?id=000199003&language=en_US) tool is really helpful here.  I just can't understand where this 25,000 limit is coming from.

Any insight is appreciated.

Andrew
We have External-Id as a check box, while creationg text,email,number data taypes only.......... why these external id are given for specific data types and why other data types doesn't have these options...... Is there any special usage of that External-Id.....Please let me with usage and code explanation................
Hi All 
I am trying to write a utility method to get only the weekdays. Is there any easy way out. here is my code so far.  The return is in the form "09/16/2014 - Tue". I just need the Date. 

public class Utility_WorkingDays {
	
	public  List<String> getHeadDates(){
        List<String> formattedDates = new List<String>();
		List<DateTime> headDates = new List<DateTime>();
		DateTime currentDate = DateTime.now();
		//Date currentDate = currentDateTime.Date;
		for (Integer idx=0; idx<28; idx++){
        	headDates.add(currentDate+idx);
	    } 
	    for(DateTime dt: headDates){
	    	String formatDatewithDay = dt.format('MM/dd/yyyy - E');
	    	formattedDates.add(formatDatewithDay);
    	   	for(Integer i = 0; i< formattedDates.size();i++){
	        	String weekend = formattedDates.get(i);
	        	system.debug('here :'+weekend);
	        	if(weekend.contains('Sun') || weekend.contains('Sat')){
	        		
	        		formattedDates.remove(i);
	        	}
        }
	      
	    }
	    system.debug('dates:'+formattedDates);
		return formattedDates;
	}
}


I am currently consulting for small to mid-size businesses and need occassional assistance building triggers as Apex is not something I am familiar with.  I am looking to form a partnership of sorts - when I need this type of help I come to you directly rather than trying to figure it out myself as learning code is not something I am particularly interested in.

If you are willing to be an jj"on-call" developer for me and my clients please message me back with your rates and keep in mind that I work for very small clients, sometimes only one user.  Thank you!

Dea Simon