• Mthobisi Ndlovu 2
  • NEWBIE
  • 25 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 6
    Replies
Hi Guys

I have 3 record types on case object Installation Support, Service Support and Site Visit Support and we are using the On-Demand Email 2 Case. I know that you can select 1 record type that can be used when creating a Case using the email case but I was wondering if there's a way to assign the record types depending on the subject or content of the email?

I would like to use all 3 record types when creating the case via Email 2 Case
Hi Guys

I'm trying to set the default value for the Case Origin field on the Case object but when creating a case the default value is not set even the though there's a value marked as "Default" which is "Phone" . How can resolve this?

Is it standard functionality that prevents the Case Origin field to have a default value?
Hi Guys.

I have a custom date field that doesn't display on Vf page when ShowHeader is set to true on VF page. If I set it to false the field works fine. What Could be the issue here? Please see code below. Thanks
<div class="row">
					<div class="col-xs-6">
						<div class="input-group">
							<label for="datePicker" class="control-label col-xs-4">Date</label>
							<div class="col-xs-6">
								<apex:inputText label="Date" styleClass="datePicker" id="date" value="{!myDate}" required="true"/> 
							</div>
						</div>
					</div>
			</div>


//Javascript
function defaultDateVal() {
  j$(".datePicker").val(getDefaultDate());
}
  function selectPreviousTimesheetDatePicker() {
  		 j$( ".datePicker" ).datepicker({
 				changeMonth: true,
                changeYear: true,
                showButtonPanel: true,
                dateFormat: 'yy/mm/dd',
             	onClose: function(dateText, inst) {
                    var date = new Date(dateText);
                    getEmployeeTimesheet(date, employeeId);
					getTotalCapturedHours(date, employeeId);
					getTotalCapturedBillableTimesheetHours(date, employeeId);
					getTotalCapturedNonBillableTimesheetHours(date, employeeId);
					populateHoursPerDay(date, employeeId);
					getTotalWorkingHoursPerMonth(date);
                }, 
             	beforeShow: function (input, inst) {            
                	j$(this).datepicker('option', 'defaultDate', new Date());
                }
     		 	});
      	
  }

 
Hi Guys.

I created a method that gets the number of weekend days between 2 dates.However when executing it, it throws a System.LimitException: Apex CPU time limit exceeded error. How can I solve this.. see code below. Thanks.
public static integer getNumberOfWeekendDaysPerMonth(Datetime startDate, Datetime endDate){
        
        integer i = 0;
        while (startDate < endDate) {
            if(startDate.format('E') == 'Sat' || startDate.format('E') == 'Sun') { // The line that throws the error.
                i += 1;
            }
            startDate.addDays(1);
        }
        return i;
    }

 
I am trying to create a Timesheet like application, there's a requirement that it should check the total number of hours (Hours Worked object) captured by the user in the previous week. If the hour worked are less than 40 hours an email reminder must be sent to the user. I created a formula field that checks the weeks the record was created. There's also a field called Billing Type which has options "Billable" and "Non Billable".. which means a user can have more hours worked records for one specific day depending on how many hours were billable and how many were not.

Scenario
user1: captures hours worked (records) for Monday - 4.5 hours ( Billable)& 3.5 (Non Billable), Tuesday - 4 Hours (Billable), Wednesday - 8 hours(Non billable), Thursday - 6 hours (Billable) & 1.5 Hours (Non Billable) , Friday - 0 hours captured (user forgot to capture them).

user2: captures hours worked (records) for Monday - 8 hours ( Billable), Tuesday - 8 Hours (Billable), Wednesday - 0, Thursday - 8hours  (Non Billable) , Friday - 8hours (Non Billable).

Since the total hours worked the previous week are less than 40 hours, On Monday morning the user will recieve an reminder to complete the hours worked. Schedulable class will be used for this.

I have create the following which will be called by the Schedulable class.
public with sharing class HoursWorkedService {


	public void sendTimesheetEmailReminder() {
		Decimal totalHours = 0;
		Set<Id> hoursWorkedIdSet = New Set<Id>();
		List<Hours_Worked__c> hoursWorkedIList = [SELECT Id From Hours_Worked__c];
		
		for (Hours_Worked__c hoursWorked: hoursWorkedIList){
			hoursWorkedIdSet.Add(hoursWorked.Id);
		} 
		
		List<Hours_Worked__c> hoursWorkedPreviousWeekList = New HoursWorkedSelector().selectPreviousWeekById(hoursWorkedIdSet);
		
		if (hoursWorkedPreviousWeekList.size() > 0) {
			for(Hours_Worked__c previousWeek: hoursWorkedPreviousWeekList){
				 totalHours = totalHours + previousWeek.Hours__c;
				if(totalHours < 40){
					System.debug('Please complete your timesheet '+totalHours);
				}
			}
		} 
	}
	
	
}

As you can see all I'm doing is just incrementing not sure if it will work, what I would like to know is,

1. How do I add up previous week hours for a specific user (user1) only.
2. The proper way of doing the calculation.
3. Sending the email alert to the user.

Thank you.
I'm currently working on customizing the Quotes template using VF since the standard configurations don't meet the clients requirements. However right now I'm stuck.

I am trying to display the Create Pdf (Created Date) field on the VF page, is there a way I could do this?
Hi Guys

I have a problem, one of the guys in company created (via call to salesforce) an enterprise trial org over a month ago and never did setup the password and security question. They only attempted to do that yesterday and the link that's on the email seems to have expired because it does not redirect to the salesforce password setup page.

I have contacted salesforce about this but still have not recieved any feedback regarding how we can salvage the org. Has anyone ever encountered such an issue? is there a way salvage the org? because according to them they purchased licenses for the org 


Now I am tasked with finding a solution to this, any suggestions guys?

Thanks.
Hi Guys.

I have a custom date field that doesn't display on Vf page when ShowHeader is set to true on VF page. If I set it to false the field works fine. What Could be the issue here? Please see code below. Thanks
<div class="row">
					<div class="col-xs-6">
						<div class="input-group">
							<label for="datePicker" class="control-label col-xs-4">Date</label>
							<div class="col-xs-6">
								<apex:inputText label="Date" styleClass="datePicker" id="date" value="{!myDate}" required="true"/> 
							</div>
						</div>
					</div>
			</div>


//Javascript
function defaultDateVal() {
  j$(".datePicker").val(getDefaultDate());
}
  function selectPreviousTimesheetDatePicker() {
  		 j$( ".datePicker" ).datepicker({
 				changeMonth: true,
                changeYear: true,
                showButtonPanel: true,
                dateFormat: 'yy/mm/dd',
             	onClose: function(dateText, inst) {
                    var date = new Date(dateText);
                    getEmployeeTimesheet(date, employeeId);
					getTotalCapturedHours(date, employeeId);
					getTotalCapturedBillableTimesheetHours(date, employeeId);
					getTotalCapturedNonBillableTimesheetHours(date, employeeId);
					populateHoursPerDay(date, employeeId);
					getTotalWorkingHoursPerMonth(date);
                }, 
             	beforeShow: function (input, inst) {            
                	j$(this).datepicker('option', 'defaultDate', new Date());
                }
     		 	});
      	
  }

 
Hi Guys.

I created a method that gets the number of weekend days between 2 dates.However when executing it, it throws a System.LimitException: Apex CPU time limit exceeded error. How can I solve this.. see code below. Thanks.
public static integer getNumberOfWeekendDaysPerMonth(Datetime startDate, Datetime endDate){
        
        integer i = 0;
        while (startDate < endDate) {
            if(startDate.format('E') == 'Sat' || startDate.format('E') == 'Sun') { // The line that throws the error.
                i += 1;
            }
            startDate.addDays(1);
        }
        return i;
    }

 
I am trying to create a Timesheet like application, there's a requirement that it should check the total number of hours (Hours Worked object) captured by the user in the previous week. If the hour worked are less than 40 hours an email reminder must be sent to the user. I created a formula field that checks the weeks the record was created. There's also a field called Billing Type which has options "Billable" and "Non Billable".. which means a user can have more hours worked records for one specific day depending on how many hours were billable and how many were not.

Scenario
user1: captures hours worked (records) for Monday - 4.5 hours ( Billable)& 3.5 (Non Billable), Tuesday - 4 Hours (Billable), Wednesday - 8 hours(Non billable), Thursday - 6 hours (Billable) & 1.5 Hours (Non Billable) , Friday - 0 hours captured (user forgot to capture them).

user2: captures hours worked (records) for Monday - 8 hours ( Billable), Tuesday - 8 Hours (Billable), Wednesday - 0, Thursday - 8hours  (Non Billable) , Friday - 8hours (Non Billable).

Since the total hours worked the previous week are less than 40 hours, On Monday morning the user will recieve an reminder to complete the hours worked. Schedulable class will be used for this.

I have create the following which will be called by the Schedulable class.
public with sharing class HoursWorkedService {


	public void sendTimesheetEmailReminder() {
		Decimal totalHours = 0;
		Set<Id> hoursWorkedIdSet = New Set<Id>();
		List<Hours_Worked__c> hoursWorkedIList = [SELECT Id From Hours_Worked__c];
		
		for (Hours_Worked__c hoursWorked: hoursWorkedIList){
			hoursWorkedIdSet.Add(hoursWorked.Id);
		} 
		
		List<Hours_Worked__c> hoursWorkedPreviousWeekList = New HoursWorkedSelector().selectPreviousWeekById(hoursWorkedIdSet);
		
		if (hoursWorkedPreviousWeekList.size() > 0) {
			for(Hours_Worked__c previousWeek: hoursWorkedPreviousWeekList){
				 totalHours = totalHours + previousWeek.Hours__c;
				if(totalHours < 40){
					System.debug('Please complete your timesheet '+totalHours);
				}
			}
		} 
	}
	
	
}

As you can see all I'm doing is just incrementing not sure if it will work, what I would like to know is,

1. How do I add up previous week hours for a specific user (user1) only.
2. The proper way of doing the calculation.
3. Sending the email alert to the user.

Thank you.
Hi Guys

I have a problem, one of the guys in company created (via call to salesforce) an enterprise trial org over a month ago and never did setup the password and security question. They only attempted to do that yesterday and the link that's on the email seems to have expired because it does not redirect to the salesforce password setup page.

I have contacted salesforce about this but still have not recieved any feedback regarding how we can salvage the org. Has anyone ever encountered such an issue? is there a way salvage the org? because according to them they purchased licenses for the org 


Now I am tasked with finding a solution to this, any suggestions guys?

Thanks.