• adroitus
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 17
    Replies

Hello Developers!

 

 

I am not able to calculate saturday if date is from friday to monday means 6/1/2012 to 9/1/2012 its total shows 3.

 

 

but if date is from friday to tuesday means 6/1/2012 to 10/1/2012 its total shows 3 its exclude both saturaday & sunday (working fine).

 

so i am not able to understand why is it calculating like that:

 

here are code for that:

 

 

DateTime dateInTheRange;
        
        for(integer j = 0; j< calculatedNoOfDays; j++)
        {
            dateInTheRange = startDate.addDays(j);
            if(dateInTheRange.format('E')=='Sat'| dateInTheRange.format('E')=='Sun')
            {
                calculatedNoOfDays--;
            }              
        }
       

 

Thanks in Advance!

 

Regards,

Ashish

Hello Developers!

 

Here are the steps i followed to change the name of lead tab-

1. Logged in as system admin.
2. Changed the tab name of Lead to "First Contact" from Setup-->Customize-->Tab Names and Labels-->Rename Tab Name and Labels.
3. Now when i login with a different user having "Standard User" as a Profile, it is still showing Lead on tab.

As per my understanding tab name should be changed to "First Contact" but it's not happening. Any help would be appreciated.

Hello Developers!

 

 

  • Is there a way to hide some of the unwanted lead fieds in salesforce.
  •  If yes what the procedure to hide the unmanted  LEAD fields tab.

 

Thanks & Regards

Ashish Agrawal

 

Hello Developer!

 

 

 I am littlebit confused how to write testmethod  for particular trigger.

And, Done some part of coding in testmethod but it gives only 36% code coverage but i need atleast 75%

 

what to write on code in testmethod to make atleast 75%.

 

Test method:

 

@istest
private class leave_testmethod
{
static testmethod void leaveprocess_testmethod()
{
   integer totalDaysFinal;
   Leave_Process__c leavetest= new Leave_Process__c();
   
test.startTest();

insert leavetest;


test.stopTest();


}
}

 

Trigger:

 

trigger trgLeaveAppBeforeInsert on Leave_Process__c(before insert) {
      
    Date startDate, endDate;
    Integer startDayofYear, endDayofYear, totalDaysFinal,totalDaysInitial;
    if(trigger.isInsert){
        for(Leave_Process__c obj : Trigger.new){
          
          
            startDate = obj.manage_packapp__Start_Date__c;
            endDate = obj.manage_packapp__End_date__c;
            // remainingLeave = obj.managed_Appsamp_Remaining_Leave_c;
          
            if(startDate.year() == endDate.year()){
              
                totalDaysInitial = endDate.dayOfYear() - startDate.dayOfYear()+1;
                totalDaysFinal = totalDaysInitial;
               
               DateTime startEndDate;
                for(integer i = 0; i< totalDaysFinal; i++){
                  
                    for (Holiday hObj : [Select activityDate from Holiday]){
                      
                       if(startDate.addDays(i) == hObj.activityDate){
                          
                            totalDaysFinal--;
                        }                      
                    }
                  
                    
                   
                }
                 // Code for calculating weekend days
                for(integer j = 0; j< totalDaysFinal; j++)
                {
                    startEndDate = startDate.addDays(j);
                    if(startEndDate.format('E')=='Sat'|startEndDate.format('E')=='Sun')
                    {
                        totalDaysFinal--;
                    }
                                    
                }
            }
            obj.manage_packapp__leaveprocess__c = totalDaysFinal;
           // obj.managed_Appsamp_Remaining_Leave_c=obj.managed_Appsamp_Remaining_Leave_c - totalDaysFinal;
          
        }

  }
}

 

 

plz help us out.

 

Thanks & Regards

Ashish Agrawal

Hello Developer!!

 

  • How to calculate remaining leave for leave application.(As we have start date & end date and from this we can calculate total number of leave days now I need to calculate remaining leave ..Assume remaining leave = 21 days)
  • so I think i need a formulA to  CALCULATE remaining Leave..

plz help me...

 

 

 

Thanks & Regards

Ashish Agrawal

Hello Developer,

 

  •   How to generate a report after saving a record from custom object for Leave application.

 

PLz Help me out....

 

 

 

Thanks & Regards

Ashish Agrawal

 

 

Hello Developer.

 

  •      i want to know how to exclude public holiday from business day if someone apply for a leave. Done with weekend days exclusion.

 

              i need u r help....

 

 

Thanks & Regards

Ashish Agrawal

    

Hi There,

 

    I dont have much idea about Web Services and so Need some examples for web services so that I can understand How we can make a request to a third party applications and get a response from it........ Help

Hi All,

 

 

any body share the direct link of ecllipes ide i have tried installing but it was failing anybody share for windows 

I'm looking for the best way to update an external database when the status of a lead is updated in our production instance of salesforce.  Is this possible using Apex triggers?

 

Hello Developers!

 

 

I am not able to calculate saturday if date is from friday to monday means 6/1/2012 to 9/1/2012 its total shows 3.

 

 

but if date is from friday to tuesday means 6/1/2012 to 10/1/2012 its total shows 3 its exclude both saturaday & sunday (working fine).

 

so i am not able to understand why is it calculating like that:

 

here are code for that:

 

 

DateTime dateInTheRange;
        
        for(integer j = 0; j< calculatedNoOfDays; j++)
        {
            dateInTheRange = startDate.addDays(j);
            if(dateInTheRange.format('E')=='Sat'| dateInTheRange.format('E')=='Sun')
            {
                calculatedNoOfDays--;
            }              
        }
       

 

Thanks in Advance!

 

Regards,

Ashish

 Hi,

how can we migrate the custom objects one develoment environment to another development enviornment 

Hello All,

 

Hoping somone can help.

 

I am using the Eclipse IDE tool to Move Custom Reports from Certain Folders in Salesforce to a Archived Folder, i have moved the files into the correct Report Folder in the Eclipse IDE Tool but when saving it to the server it says that File Only Saved Locally, not to server.

 

Can someone help ?

 

Thanks

Jim

 

Hi All,

Hope all are doing well,

Actually i created a profile and also user , in user we will link the profile, so after selecting the created profile in user, i am unable to get the changes to the user which are described in respective profile, i am getting a message 

License Limit Exceeded
All of your user licenses are currently in use by active users. 
Can you guys please tell me the solution.

 

Hello Developer!

 

 

 I am littlebit confused how to write testmethod  for particular trigger.

And, Done some part of coding in testmethod but it gives only 36% code coverage but i need atleast 75%

 

what to write on code in testmethod to make atleast 75%.

 

Test method:

 

@istest
private class leave_testmethod
{
static testmethod void leaveprocess_testmethod()
{
   integer totalDaysFinal;
   Leave_Process__c leavetest= new Leave_Process__c();
   
test.startTest();

insert leavetest;


test.stopTest();


}
}

 

Trigger:

 

trigger trgLeaveAppBeforeInsert on Leave_Process__c(before insert) {
      
    Date startDate, endDate;
    Integer startDayofYear, endDayofYear, totalDaysFinal,totalDaysInitial;
    if(trigger.isInsert){
        for(Leave_Process__c obj : Trigger.new){
          
          
            startDate = obj.manage_packapp__Start_Date__c;
            endDate = obj.manage_packapp__End_date__c;
            // remainingLeave = obj.managed_Appsamp_Remaining_Leave_c;
          
            if(startDate.year() == endDate.year()){
              
                totalDaysInitial = endDate.dayOfYear() - startDate.dayOfYear()+1;
                totalDaysFinal = totalDaysInitial;
               
               DateTime startEndDate;
                for(integer i = 0; i< totalDaysFinal; i++){
                  
                    for (Holiday hObj : [Select activityDate from Holiday]){
                      
                       if(startDate.addDays(i) == hObj.activityDate){
                          
                            totalDaysFinal--;
                        }                      
                    }
                  
                    
                   
                }
                 // Code for calculating weekend days
                for(integer j = 0; j< totalDaysFinal; j++)
                {
                    startEndDate = startDate.addDays(j);
                    if(startEndDate.format('E')=='Sat'|startEndDate.format('E')=='Sun')
                    {
                        totalDaysFinal--;
                    }
                                    
                }
            }
            obj.manage_packapp__leaveprocess__c = totalDaysFinal;
           // obj.managed_Appsamp_Remaining_Leave_c=obj.managed_Appsamp_Remaining_Leave_c - totalDaysFinal;
          
        }

  }
}

 

 

plz help us out.

 

Thanks & Regards

Ashish Agrawal

Hello Developer!!

 

  • How to calculate remaining leave for leave application.(As we have start date & end date and from this we can calculate total number of leave days now I need to calculate remaining leave ..Assume remaining leave = 21 days)
  • so I think i need a formulA to  CALCULATE remaining Leave..

plz help me...

 

 

 

Thanks & Regards

Ashish Agrawal

Hello Developer.

 

  •      i want to know how to exclude public holiday from business day if someone apply for a leave. Done with weekend days exclusion.

 

              i need u r help....

 

 

Thanks & Regards

Ashish Agrawal

    

The following formula will calculate the number of working days (inclusive) between 2 dates. A working day is defined as Monday to Friday. Even if the start or end dates are a weekend, these are accommodated.

IF(AND((5 - (CASE(MOD( Start_Date__c - DATE(1900, 1, 6), 7), 0, 0, 1, 5, 2, 5, 3, 4, 4, 3, 5, 2, 6, 1, 0)) < (CASE(MOD(  End_Date__c  - DATE(1900, 1, 6), 7), 0, 0, 1, 0, 2, 1, 3, 2, 4, 3, 5, 4, 6, 5, 0)) ),
((( End_Date__c  -   Start_Date__c ) + 1) < 7)),
((CASE(MOD(  End_Date__c  - DATE(1900, 1, 6), 7), 0, 0, 1, 0, 2, 1, 3, 2, 4, 3, 5, 4, 6, 5, 0)) - (5 - (CASE(MOD(  Start_Date__c  - DATE(1900, 1, 6), 7), 0, 0, 1, 5, 2, 5, 3, 4, 4, 3, 5, 2, 6, 1, 0)))),
(((FLOOR((( End_Date__c  -  Start_Date__c ) - (CASE(MOD(  Start_Date__c  - DATE(1900, 1, 6), 7), 0, 0, 1, 6, 2, 5, 3, 4, 4, 3, 5, 2, 6, 1, 0))) / 7)) * 5) +
(CASE(MOD(  Start_Date__c  - DATE(1900, 1, 6), 7), 0, 0, 1, 5, 2, 5, 3, 4, 4, 3, 5, 2, 6, 1, 0)) +
(CASE(MOD(  End_Date__c  - DATE(1900, 1, 6), 7), 0, 0, 1, 0, 2, 1, 3, 2, 4, 3, 5, 4, 6, 5, 0))))


The Start Date and End Date fields are custom in the above example and can be replaced as required. If use of a DateTime field is required then the DATEVALUE function will be required.

I also recommend a simple field validation rule is added to check that the End Date is after the Start Date.
  • January 05, 2009
  • Like
  • 2