• Pranav_Vaidya
  • NEWBIE
  • 99 Points
  • Member since 2012

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

Hi,

 

Is it possible to create a dashboard without any columns or maximum 1 column which is page wide? When I tried to delete default columns I could delete up to 2 columns only, I mean there were always 2 columns.

 

I have 3 cusom VF Pages which I would like to show one below other in page wide/screen on my dashboard.

 

Any suggestions??

 

Thanks.

Hi,

 

I am validating input from a custom VF Page. Everything works fine inclyding the validation function except the error message is not shown on the VF page when Controller class returns PageReference.

I am trying to do this -

  - Validate user input on click of Save button

  - If there is an errror stay on the same VF page with relevant error message shown

Any help is much appreciated. Thanks.

 

Below is controller class code-

public class CustomTripEntryController {
   private String stCurrentPageURL;
   public Leg__c CurrTripLeg {get; set;}
 
  public CustomTripEntryController(ApexPages.StandardSetController TripStdController){
    stCurrentPageURL = ApexPages.currentPage().getURL();
  }

  public pagereference InsertNewRecord(){
    if(CheckInput() == false){
      ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Validation Failed'));  --> Add error msg
      PageReference currPage = new PageReference(stCurrentPageURL); 
     pageref.setredirect(true);  --> Return page reference
     return currPage;
  } else{
      try{
          //Logic to insert new record
     } catch (exception e){
        //Error handler
    }
  }
}

private boolean CheckInput(){    -->Function to validate input
    boolean blIsInputValid = false;
    //Validate From_City
    system.debug('Validating From city');
    if(currTripLeg.From_City__c == null){
      system.debug('from City not found');
      blIsInputValid = false; }
    else {
       system.debug('From City found');
       blIsInputValid = true;
    }
    return blIsInputValid;
}
}

Hi,

 

Below is from my controller extension class. I have a VF page with standard controller as a custom object.

For the below line of code I get an error - Illegal assignment from Database.SaveResult to LIST<Database.SaveResult>

 

Code:

Database.SaveResult[] MySaveResult = Database.Insert(currTrip, false );

 

My code line is exactly as given in the Apex Developer's guide. I don't understand what's going wrong here!!

Any help is much appreciated.

 

Thanks.

Hi,

 

I have 2 approval processes for a record, the flow generally is like this...

 

Step 1 - Entry criteria Status = 'Planned'

Record status changed to 'Planned'

Submit to Manger A

 

Step 2

Manager A approves,

Record status changed to 'Approver (Mgr)'

Record unlocked and re-assigned to owner

Record owner (original requestor) updates additional fields, changes status to 'Request Regioal Mgr Approval' and  submits to Manager B

 

Step 3 - Entry criteria Status = 'Request Regioal Mgr Approval'

Manager B approves

Record status changed to 'Approved (Reg. Mgr)'

Record is locked

 

I was able to achieve this with 2 different workflow processes on the same object. However I could not re-submit the record after step 2 cause I got an error that the current record does not meet an entry criteria for approval process.

 

Can I write some Apex code, trigger to achieve this?

 

Thanks.

Hi,

 

Our process is rather unique and I am trying to work out how to fit it in SalesForce approval processes.

 

Our app is about booking travel for our users and process is like below

 

Step I - Inputter submits to Manager A, Manager A approves/rejects, the trip record is assigned back to Inputter

 

Step II - Trip inputter gathers other details & submits to Manager B for approval, Manager B approves/rejects, trip record is locked

 

I designed a workflow for this which is decided on trip status. However I am not able to achieve the below

 

1. After approval by Manager A in step I the record is assigned to inputter but workflow process asks for approval by trip inputter. Essentially after Phase I is complte the inputter should see 'Submit for approval' button once again cause now they would be submitting to a different manager for final approval.

 

2. I don't want the record to be locked anytime until Step II is complete. In other words, record should be in edit mode until the final approval.

 

Any help is much appreciated.

 

Thanks. 

 

 

Hi,

 

I have a nested class like below. How do I write test script which covers the sub class.

I can't increase the overall test % without adding tests for these 2 sub classes.

 

Thanks.

 

 

 

public class Trips{                   

  Private List <MonthlyTrip> lstJanTrips=new List <MonthlyTrip>();
  Private List <MonthlyTripArray> lstAllTrips=new List <MonthlyTripArray>();


  
//Constructor of the class
  Public Trips(){
  }

//Create All Trips array   
  Public List <MonthlyTripArray> getAllTrips(){
    String stOldCity='';
    String stJanAnalysts='';
    String stFebAnalysts='';
    String stMarAnalysts='';
    String stAprAnalysts='';
   
          MonthlyTripArray ObjAllMonthlyTrip=new MonthlyTripArray (stOldCity,StJanAnalysts,StFebAnalysts,StMarAnalysts,StAprAnalysts);
          lstAllTrips.Add (ObjAllMonthlyTrip);                    
            return lstAllTrips;  
}
//****************************************************

//Create Trips in Jan list  
  Public List <MonthlyTrip> getJanTrips(){
    String stOldCity='';
    String stAnalysts='';
    
           MonthlyTrip ObjMonthlyTrip=new MonthlyTrip(stOldCity, StAnalysts);
           lstJanTrips.Add (ObjMonthlyTrip);
  return lstJanTrips;  
}

//*********** First sub class *****************************
  Class MonthlyTripArray{
    Public String CityName{get; set;}
    Public String JanAnalysts{get; set;}
    Public String FebAnalysts{get; set;}
    Public String MarAnalysts{get; set;}
    Public String AprAnalysts{get; set;}


    Public MonthlyTripArray(String Cn, String JAn, String FAn,String MAn, String AAn){
      CityName = Cn;
      JanAnalysts=JAn;
      FebAnalysts=FAn;
      MarAnalysts=MAn;
      AprAnalysts=AAn;      
    }     
  }
//*********** Second sub class *****************************
  Class MonthlyTrip{
    Public String CityName{get; set;}
    Public String Analysts{get; set;}
    
    Public MonthlyTrip(String Cn, String An){
      CityName = Cn;
      Analysts=An;      
    }      
  } 
   
}

Hi,

 

Below is my Apex class. When I use this on my VF page there are no errors. However when I test run this from a test class I get error System.ListException: List index out of bounds: 0

Can you please point me what is going wrong here.

 

Thanks.

 

 

public class MyBudgetSnapShot {

 List <Travel_budget_cost__c> myBud = [Select Asset_class_Travel_Budget__c,Travel_budget_actual__c, Travel_budget_cost__c,Travel_budget_forecast__c
                               from Travel_budget_cost__c where id = 'a00s000Fc1Qt'];                              

 string strUserRoleId = UserInfo.getUserRoleId();
 UserRole usr= [Select Id,Name from UserRole where Id= :strUserRoleId];
 String strUserRole =usr.Name;
//****************    
 public string getAssetClassName(){
   List <Asset_class__c> CurrAstCls=[Select Name from Asset_class__c where Id = :myBud[0].Asset_class_Travel_Budget__c ];   -->This line is pointed as error
  return CurrAstCls[0].Name;
 } }

Hi,

 

I have a bunch of VF pages. I have created test class and have added test methods for each page. However I would like to take this further to meet the expected test %.

 

My VF pages has custom controllers assigned. In the custon controller class there are child classes declared.

What should be added to the below test class to increase test %.

 

Thanks.

 

Visual Force Page

public class TripByMonth{
                  
  Private List <AggregateResult> LstTripLegs=new List <AggregateResult>();
  Private List <AggregateResult> LstTripLegCities=new List <AggregateResult>();
  Private List <MonthlyTrip> lstJanTrips=new List <MonthlyTrip>();
  Private List <MonthlyTrip> lstFebTrips=new List <MonthlyTrip>();
  Private List <MonthlyTripArray> lstAllTrips=new List <MonthlyTripArray>();


  
//Constructor of the class
  PublictTripByMonth(){
    LstTripLegs=[SELECT To_City__r.Name TravelTo,Trip__r.Analyst__r.Name Analyst, Calendar_Month(Trip_leg_From_date__c)cal_mon                   
            FROM Leg__C GROUP BY Calendar_Month(Trip_leg_From_date__c), To_City__r.Name,Trip__r.Analyst__r.Name
            ORDER BY To_City__r.Name];

   LstTripLegCities=[SELECT To_City__r.Name TravelTo, Count(Trip__r.Analyst__r.Name) CntAn,Calendar_Month(Trip_leg_From_date__c)cal_mon                   
            FROM Leg__C GROUP BY Calendar_Month(Trip_leg_From_date__c), To_City__r.Name
            ORDER BY To_City__r.Name];
            
  }
//Trip record list
   Public List <LegInfo> getLegsForReport(){
     List <LegInfo> LstLegs = new List <LegInfo>();
     
     for (AggregateResult ARs:LstTripLegs){
       LegInfo ObjLegInfo=new LegInfo(ARs);
       LstLegs.Add (ObjLegInfo);       
     }     
     Return LstLegs;     
   }
//Create All Trips array   
  Public List <MonthlyTripArray> getAllTrips(){
    String stOldCity='';
    String stJanAnalysts='';
    String stFebAnalysts='';
    String stMarAnalysts='';
    String stAprAnalysts='';

    
    for (AggregateResult ARJan:LstTripLegs){
       if(stOldCity ==''){
         stOldCity = (String)ARJan.get('TravelTo');
       }
       if(stOldCity != (String)ARJan.get('TravelTo')){
          MonthlyTripArray ObjAllMonthlyTrip=new MonthlyTripArray (stOldCity,StJanAnalysts,StFebAnalysts,StMarAnalysts,StAprAnalysts);
          lstAllTrips.Add (ObjAllMonthlyTrip);                    
          stOldCity = (String)ARJan.get('TravelTo');
          StJanAnalysts='';
          StFebAnalysts='';
          StMarAnalysts='';
          StAprAnalysts='';          
          Continue;
       }        
       if ((Integer) ARJan.get('cal_mon') == 1) {       
        StJanAnalysts = StJanAnalysts + (String)ARJan.get('Analyst')+ '<br>';                   
       }       
       if ((Integer) ARJan.get('cal_mon') == 2) {       
        StFebAnalysts = StFebAnalysts + (String)ARJan.get('Analyst')+ '<br>';                   
       }
    }    
  return lstAllTrips;  
}
//****************************************************
  Class MonthlyTripArray{
    Public String CityName{get; set;}
    Public String JanAnalysts{get; set;}
    Public String FebAnalysts{get; set;}


    Public MonthlyTripArray(String Cn, String JAn, String FAn){
      CityName = Cn;
      JanAnalysts=JAn;
      FebAnalysts=FAn;
    }
      
  }
//****************************************************
  Class MonthlyTrip{
    Public String CityName{get; set;}
    Public String Analysts{get; set;}
    
    Public MonthlyTrip(String Cn, String An){
      CityName = Cn;
      Analysts=An;      
    }
      
  }   
}

 

Test Class method-

 Public static  testMethod void VFPageTest_TripDashboard(){
     PageReference pgRef = Page.TripDashboard;
     Test.setCurrentPageReference (pgRef);
     TripByMonth myPgCont = new TripByMonth();  
     
   }

Hi,

 

Below is my VF page and Controller class code. I have a look-up field on my VF page. I type in city name and click on Add. I have java script function (I think it is AJAX) which shows this value on Apex InputTextArea. Everything works except that the selected value appears on the InputTextArea control and disappears. I am suspecting something to do with page refresh but not sure.

I have highlighted the important blocks of code.

 

Any help is much appreciated. Thanks in advance.

 

VF Page-

<apex:page standardController="Leg__c"  extensions="TripLegsGroupBookController" recordSetVar="Leg__c" tabStyle="Leg__c">
 
 <apex:pageblock title="Group book legs">
  <apex:form id="mForm" >
    <script type="text/javascript"> 
      function doSave(sname) { 
        CityName(document.getElementById(sname).value); 
      } 
    </script>

    <apex:actionFunction name="CityName" action="{!ReadCityNames}" rerender="SelctCity">
      <apex:param name="CityNames" value="" assignTo="{!stcityName}" />
    </apex:actionFunction>
  
    <apex:pageblockSection columns="2">
       <apex:pageblockSectionItem >
          <apex:outputLabel value="City travelling:"/>      
          <apex:outputPanel >       
            <apex:inputField id="TravelCity" value="{!GroupLeg.To_City__c}"  />
            <apex:commandLink value="Add" onclick="doSave('{!$Component.TravelCity}')"/>
          </apex:outputPanel> 
       </apex:pageblockSectionItem>
       <apex:pageblockSectionItem >
          <apex:outputLabel value="Selected city/ies:"/>      
          <apex:outputPanel id="SelctCity">       
            <apex:inputtextarea id="SelCity" value="{!stcityName}"/>
          </apex:outputPanel> 
       </apex:pageblockSectionItem>
    </apex:pageBlockSection>           
  </apex:form>
  </apex:pageblock>

</apex:page>

 

Controller class

Public class TripLegsGroupBookController{
   Private final Leg__c myTripLeg;
   Public String stCityName{get; set;}
   public String TCity{get; set;}  
   
   Public TripLegsGroupBookController(ApexPages.StandardSetController LegStdController){
    this.myTripLeg=(Leg__c) LegStdController.getRecord();
   }
//************************************   
   Public Leg__c getGroupLeg(){    
     Return myTripLeg;
   }
//************************************   
   Public PageReference ReadCityNames(){
     stcityName=TCity + ', ' + Apexpages.currentpage().getParameters().get('CityNames');
     TCity=stcityName;
     return null;   
   }  
//************************************   
   Public String getTCity(){
     return stcityName;
   }
//************************************   
   Public String getstcityName(){
     return stcityName;
   }      
}

Hi,

 

I looked on the community and I found that there are several posts with similar topic. While it helped me understand what needs to be changed all those posts did not resolve my problem.

 

I want to create a Custom Link Button on my object which launches a VF page that I have developed. My VF page has this object as Standard controller. Yet when I select Content source as VF page the content drop down is empty.

 

This is my VF page starting...

<apex:page standardController="Leg__c"  extensions="LegsGroupBookController" tabStyle="Leg__c">

 

Any help is much appreciated.

 

Thanks. 

 

Hi,

 

I have a standard controller and an extension class. I have a lookup filed City__c on my V page. I have another filed on my VF page as 'Selected cities'. This is apex TextArea field. And finally I have an apex command button as 'Select'

 

I would like to write a function in the controller class which does the below-

1. when I click on 'Select' button it adds the currently looked up value to the 'Selected cities' InputTextarea control.

2. Each new value is added on a separate row

3. When I click on 'Save' these values are passed back to my controller class where I would use them for further calculation.

 

I have got various pieces together however I need help with the below-

-  A function which sets value of Apex InputTextarea while retaining the existing text

-  How to pass the current value back to my controller class

 

I don't know if using Apex parameters and List contorl would be a good idea??

Any help is much appreciated.

Hi,

 

Below is my trigger code. The trigger itself works as expected however when I test it using a test class the test coverage shown is only 64% and this less % does not allow me to include the custom object to my package.

 

I have highlighted the lines of code which are not covered by test run. How do I make the test coverage more than 75%.

Any help is much is appreciated. Thanks.

 

trigger TripAfterTrigger on Trip__c (after insert,after update) {
  
//Update Travel Budget table forecasts
   Trip__c CurrTrip = (Trip__c) Trigger.new[0]; 
   string BudMonth='';
   
   if(CurrTrip.Month__c != null && CurrTrip.Total_Flight_cost__c!=null){
     BudMonth=CurrTrip.Month__c;
    
     List <TravelBudgetDetail__c> tbc = [select Travel_Budget_Forecast_Month__c, Travel_Month__c from TravelBudgetDetail__c
                                         where  Travel_budget__r.Asset_class_Travel_Budget__c = :CurrTrip.Analyst_Asset_Class__c];
     for (integer i=0; i<tbc.size();i++) {
      if(tbc[i].Travel_Month__c!=null){ 
        if(tbc[i].Travel_Month__c.substring(0,3).equalsIgnoreCase(BudMonth)){
          if (tbc[i].Travel_Budget_Forecast_Month__c == null) {
            tbc[i].Travel_Budget_Forecast_Month__c = 0;
          }
          tbc[i].Travel_Budget_Forecast_Month__c = tbc[i].Travel_Budget_Forecast_Month__c + CurrTrip.Total_Flight_cost__c; 
          break;
        }  
       }
     }   
     Update tbc;
   }

 }

 

Hi,

 

I have a VF page and a controller for this page. The controller uses an instance of one of my custom objects. This custom has a look-up field which I am showing on my VF page. Below is my VF page code. When I click on Add I expect the Javascript function to show the value entered in the look-up field but there is no output. I am missing something...could you please help me understand why my function is not displaying the entered value.

 

Thanks in advance.

 

Code-

<apex:page controller="TripLegsGroup" >

<script>
  function AddCity() {
    alert('Entered');
    var mct = document.getElementById('{!$Component.mForm.mCity}').value;
    alert (mct);   
  }
   
</script>

 

<apex:pageblock title="Group book legs">
  <apex:form id="mForm" >
    <apex:pageBlock title="Enter trip leg details">
      <apex:pageblockSection columns="2">
       <apex:pageblockSectionItem >
          <apex:outputLabel value="Travelling to:"/>
          <apex:outputPanel >
             <apex:inputField id="mCity" value="{!GroupLeg.To_City__c}"  />   <-- This is look-up field, I would like to display the entered value
             <apex:commandButton value="Add" onkeypress="return AddCity()"/>  <-- This command button click calls JS function
          </apex:outputPanel>
       </apex:pageblockSectionItem>
      </apex:pageblockSection>
    </apex:pageBlock>      
  </apex:form>
  </apex:pageblock>

</apex:page>

Hi,

 

I have set-up an approval process for Cases in my app. Everything works fine but the email alerts.

 

Depending on the 'Case' I would like the approval process to send an email to one country manager or in some cases 20 country managers. The challenge is these managers are not users on SFCM, they are stored as record under custom object. Moreover, the country managers will depend on the 'Case' (a look-up on country will evaluate related country manager) so I can not pre-define on workflow who receives the email.

 

How can I do this? How can I send email alert to more than one person using workflow-approval process?

 

Any help is much appreciated. Thanks.

Below is a method from my controller class. This method is expected to return a LIST with 3 elements. How can I use these 3 elements on my VF page. I don't want to use <apex:repeat>. I want to use all 3 elements in different page blocks on my VF page.

 

Thanks in advance.

 

public List <double> getYTDBudget(){
  AggregateResult[] YTDBud = [Select sum(Budget_Allotted_Month__c)YTDAllot, sum(Budget_Forecast_Month__c)YTDForecast, 
                               sum(Budget_Actual_Month__c)YTDAct
                               from TravelBudgetDetail__c where Travel_budget__r.Id  = 'BD0000cR5a'];  

  List <double> YTDBg=new double[3];

  YTDBg.Set(0, (double) YTDBud[0].get('YTDAllot'));
  
  if ((double) YTDBud[0].get('YTDForecast') == 0 ){
    YTDBg.Set(1,0);
  }
  else{
    YTDBg.Set(1,(double) YTDBud[0].get('YTDForecast'));
  }
  
  YTDBg.Set(2,(double) YTDBud[0].get('YTDAct')); 

  return YTDBg;

 }

 


 

Hi,

 

I have a custom object which has below fields-

 

Month

Allotted_Budget_Spend

Forecast_Budget_spend

Actual_Budget_Spend

 

I have created a component which fetches records from this custom object. I would like to create a VF page to display it in HTML table as

 

 

Jan-2012

Feb-2012

Mar-2012

YTD

Toal

Allotted_Budget_Spend

 

 

 

 

 

Forecast_Budget_spend

 

 

 

 

 

Actual_Budget_Spend

 

 

 

 

 

 

Could someone please help. If you think I can achieve this other than a VF page please suggest.

 

Thanks in advance.

Regards,

Pranav

Hi,

 

I am new to Visual Force development and creating my first visual force page. All that I want to do is show records from a custom object on a VF page. I don't see any employee names.

 

Below is my code.

<apex:page standardController="Employee__c" >    

   <apex:pageBlock title="Employee details">      

       Employee email -  {!Employee__c.Emp_Email__c}       

   </apex:pageBlock>   

   <apex:detail />  

</apex:page>

 

Any help is much appreciated.

Thanks.

Hi,

 

I have a master-detail relation on 2 custom objects. I have set-up an email alert on the parent object. I can access all the fields from the parent object while creating the email body. However the fields from child table are not accesible. I even tried to use the API code for the relevant fields, no luck.

 

How can I show the child records on an email alert.

 

for example, when the order email goes to the approver it has only Order header info such as total cost, supplier etc. How can I include the item details which are records from the child object.

 

Thanks.

Hi,

 

I have set-up an email alert with some workflow rules. Everything works perfect as set-up except the email alert generates 2 emails.

The receipt receives 2 emails from the app. I have cheked the e-mail alert setting, there is only 1 person set-up to receive the email.

 

The first email is sent as below-

From-  My name

Sent by:     no-reply@salesforce.com

Please respond to     "Email Approval" < the long code>

 

The second email is sent as below-

From- my.organization@mydomain.com

Sent by: no-reply@salesforce.com

 

There is no third line on the second email.

 

The problem here is that-

1. Why 2 emails are generated

2. Why the email from Organization name is missing "Please respond to"

 

Any help is much appreciated.

Thanks.

Hi,

 

Is it possible to create a dashboard without any columns or maximum 1 column which is page wide? When I tried to delete default columns I could delete up to 2 columns only, I mean there were always 2 columns.

 

I have 3 cusom VF Pages which I would like to show one below other in page wide/screen on my dashboard.

 

Any suggestions??

 

Thanks.

Hi,

 

I am validating input from a custom VF Page. Everything works fine inclyding the validation function except the error message is not shown on the VF page when Controller class returns PageReference.

I am trying to do this -

  - Validate user input on click of Save button

  - If there is an errror stay on the same VF page with relevant error message shown

Any help is much appreciated. Thanks.

 

Below is controller class code-

public class CustomTripEntryController {
   private String stCurrentPageURL;
   public Leg__c CurrTripLeg {get; set;}
 
  public CustomTripEntryController(ApexPages.StandardSetController TripStdController){
    stCurrentPageURL = ApexPages.currentPage().getURL();
  }

  public pagereference InsertNewRecord(){
    if(CheckInput() == false){
      ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Validation Failed'));  --> Add error msg
      PageReference currPage = new PageReference(stCurrentPageURL); 
     pageref.setredirect(true);  --> Return page reference
     return currPage;
  } else{
      try{
          //Logic to insert new record
     } catch (exception e){
        //Error handler
    }
  }
}

private boolean CheckInput(){    -->Function to validate input
    boolean blIsInputValid = false;
    //Validate From_City
    system.debug('Validating From city');
    if(currTripLeg.From_City__c == null){
      system.debug('from City not found');
      blIsInputValid = false; }
    else {
       system.debug('From City found');
       blIsInputValid = true;
    }
    return blIsInputValid;
}
}

Hi,

 

Below is from my controller extension class. I have a VF page with standard controller as a custom object.

For the below line of code I get an error - Illegal assignment from Database.SaveResult to LIST<Database.SaveResult>

 

Code:

Database.SaveResult[] MySaveResult = Database.Insert(currTrip, false );

 

My code line is exactly as given in the Apex Developer's guide. I don't understand what's going wrong here!!

Any help is much appreciated.

 

Thanks.

Hi,

 

I have a nested class like below. How do I write test script which covers the sub class.

I can't increase the overall test % without adding tests for these 2 sub classes.

 

Thanks.

 

 

 

public class Trips{                   

  Private List <MonthlyTrip> lstJanTrips=new List <MonthlyTrip>();
  Private List <MonthlyTripArray> lstAllTrips=new List <MonthlyTripArray>();


  
//Constructor of the class
  Public Trips(){
  }

//Create All Trips array   
  Public List <MonthlyTripArray> getAllTrips(){
    String stOldCity='';
    String stJanAnalysts='';
    String stFebAnalysts='';
    String stMarAnalysts='';
    String stAprAnalysts='';
   
          MonthlyTripArray ObjAllMonthlyTrip=new MonthlyTripArray (stOldCity,StJanAnalysts,StFebAnalysts,StMarAnalysts,StAprAnalysts);
          lstAllTrips.Add (ObjAllMonthlyTrip);                    
            return lstAllTrips;  
}
//****************************************************

//Create Trips in Jan list  
  Public List <MonthlyTrip> getJanTrips(){
    String stOldCity='';
    String stAnalysts='';
    
           MonthlyTrip ObjMonthlyTrip=new MonthlyTrip(stOldCity, StAnalysts);
           lstJanTrips.Add (ObjMonthlyTrip);
  return lstJanTrips;  
}

//*********** First sub class *****************************
  Class MonthlyTripArray{
    Public String CityName{get; set;}
    Public String JanAnalysts{get; set;}
    Public String FebAnalysts{get; set;}
    Public String MarAnalysts{get; set;}
    Public String AprAnalysts{get; set;}


    Public MonthlyTripArray(String Cn, String JAn, String FAn,String MAn, String AAn){
      CityName = Cn;
      JanAnalysts=JAn;
      FebAnalysts=FAn;
      MarAnalysts=MAn;
      AprAnalysts=AAn;      
    }     
  }
//*********** Second sub class *****************************
  Class MonthlyTrip{
    Public String CityName{get; set;}
    Public String Analysts{get; set;}
    
    Public MonthlyTrip(String Cn, String An){
      CityName = Cn;
      Analysts=An;      
    }      
  } 
   
}

Hi,

 

Below is my Apex class. When I use this on my VF page there are no errors. However when I test run this from a test class I get error System.ListException: List index out of bounds: 0

Can you please point me what is going wrong here.

 

Thanks.

 

 

public class MyBudgetSnapShot {

 List <Travel_budget_cost__c> myBud = [Select Asset_class_Travel_Budget__c,Travel_budget_actual__c, Travel_budget_cost__c,Travel_budget_forecast__c
                               from Travel_budget_cost__c where id = 'a00s000Fc1Qt'];                              

 string strUserRoleId = UserInfo.getUserRoleId();
 UserRole usr= [Select Id,Name from UserRole where Id= :strUserRoleId];
 String strUserRole =usr.Name;
//****************    
 public string getAssetClassName(){
   List <Asset_class__c> CurrAstCls=[Select Name from Asset_class__c where Id = :myBud[0].Asset_class_Travel_Budget__c ];   -->This line is pointed as error
  return CurrAstCls[0].Name;
 } }

Hi,

 

Below is my VF page and Controller class code. I have a look-up field on my VF page. I type in city name and click on Add. I have java script function (I think it is AJAX) which shows this value on Apex InputTextArea. Everything works except that the selected value appears on the InputTextArea control and disappears. I am suspecting something to do with page refresh but not sure.

I have highlighted the important blocks of code.

 

Any help is much appreciated. Thanks in advance.

 

VF Page-

<apex:page standardController="Leg__c"  extensions="TripLegsGroupBookController" recordSetVar="Leg__c" tabStyle="Leg__c">
 
 <apex:pageblock title="Group book legs">
  <apex:form id="mForm" >
    <script type="text/javascript"> 
      function doSave(sname) { 
        CityName(document.getElementById(sname).value); 
      } 
    </script>

    <apex:actionFunction name="CityName" action="{!ReadCityNames}" rerender="SelctCity">
      <apex:param name="CityNames" value="" assignTo="{!stcityName}" />
    </apex:actionFunction>
  
    <apex:pageblockSection columns="2">
       <apex:pageblockSectionItem >
          <apex:outputLabel value="City travelling:"/>      
          <apex:outputPanel >       
            <apex:inputField id="TravelCity" value="{!GroupLeg.To_City__c}"  />
            <apex:commandLink value="Add" onclick="doSave('{!$Component.TravelCity}')"/>
          </apex:outputPanel> 
       </apex:pageblockSectionItem>
       <apex:pageblockSectionItem >
          <apex:outputLabel value="Selected city/ies:"/>      
          <apex:outputPanel id="SelctCity">       
            <apex:inputtextarea id="SelCity" value="{!stcityName}"/>
          </apex:outputPanel> 
       </apex:pageblockSectionItem>
    </apex:pageBlockSection>           
  </apex:form>
  </apex:pageblock>

</apex:page>

 

Controller class

Public class TripLegsGroupBookController{
   Private final Leg__c myTripLeg;
   Public String stCityName{get; set;}
   public String TCity{get; set;}  
   
   Public TripLegsGroupBookController(ApexPages.StandardSetController LegStdController){
    this.myTripLeg=(Leg__c) LegStdController.getRecord();
   }
//************************************   
   Public Leg__c getGroupLeg(){    
     Return myTripLeg;
   }
//************************************   
   Public PageReference ReadCityNames(){
     stcityName=TCity + ', ' + Apexpages.currentpage().getParameters().get('CityNames');
     TCity=stcityName;
     return null;   
   }  
//************************************   
   Public String getTCity(){
     return stcityName;
   }
//************************************   
   Public String getstcityName(){
     return stcityName;
   }      
}

Hi,

 

I looked on the community and I found that there are several posts with similar topic. While it helped me understand what needs to be changed all those posts did not resolve my problem.

 

I want to create a Custom Link Button on my object which launches a VF page that I have developed. My VF page has this object as Standard controller. Yet when I select Content source as VF page the content drop down is empty.

 

This is my VF page starting...

<apex:page standardController="Leg__c"  extensions="LegsGroupBookController" tabStyle="Leg__c">

 

Any help is much appreciated.

 

Thanks. 

 

Hi,

 

Below is my trigger code. The trigger itself works as expected however when I test it using a test class the test coverage shown is only 64% and this less % does not allow me to include the custom object to my package.

 

I have highlighted the lines of code which are not covered by test run. How do I make the test coverage more than 75%.

Any help is much is appreciated. Thanks.

 

trigger TripAfterTrigger on Trip__c (after insert,after update) {
  
//Update Travel Budget table forecasts
   Trip__c CurrTrip = (Trip__c) Trigger.new[0]; 
   string BudMonth='';
   
   if(CurrTrip.Month__c != null && CurrTrip.Total_Flight_cost__c!=null){
     BudMonth=CurrTrip.Month__c;
    
     List <TravelBudgetDetail__c> tbc = [select Travel_Budget_Forecast_Month__c, Travel_Month__c from TravelBudgetDetail__c
                                         where  Travel_budget__r.Asset_class_Travel_Budget__c = :CurrTrip.Analyst_Asset_Class__c];
     for (integer i=0; i<tbc.size();i++) {
      if(tbc[i].Travel_Month__c!=null){ 
        if(tbc[i].Travel_Month__c.substring(0,3).equalsIgnoreCase(BudMonth)){
          if (tbc[i].Travel_Budget_Forecast_Month__c == null) {
            tbc[i].Travel_Budget_Forecast_Month__c = 0;
          }
          tbc[i].Travel_Budget_Forecast_Month__c = tbc[i].Travel_Budget_Forecast_Month__c + CurrTrip.Total_Flight_cost__c; 
          break;
        }  
       }
     }   
     Update tbc;
   }

 }

 

Hi,

 

I have set-up an approval process for Cases in my app. Everything works fine but the email alerts.

 

Depending on the 'Case' I would like the approval process to send an email to one country manager or in some cases 20 country managers. The challenge is these managers are not users on SFCM, they are stored as record under custom object. Moreover, the country managers will depend on the 'Case' (a look-up on country will evaluate related country manager) so I can not pre-define on workflow who receives the email.

 

How can I do this? How can I send email alert to more than one person using workflow-approval process?

 

Any help is much appreciated. Thanks.

Hi,

 

I have a custom object which has below fields-

 

Month

Allotted_Budget_Spend

Forecast_Budget_spend

Actual_Budget_Spend

 

I have created a component which fetches records from this custom object. I would like to create a VF page to display it in HTML table as

 

 

Jan-2012

Feb-2012

Mar-2012

YTD

Toal

Allotted_Budget_Spend

 

 

 

 

 

Forecast_Budget_spend

 

 

 

 

 

Actual_Budget_Spend

 

 

 

 

 

 

Could someone please help. If you think I can achieve this other than a VF page please suggest.

 

Thanks in advance.

Regards,

Pranav

Hi,

 

I am new to Visual Force development and creating my first visual force page. All that I want to do is show records from a custom object on a VF page. I don't see any employee names.

 

Below is my code.

<apex:page standardController="Employee__c" >    

   <apex:pageBlock title="Employee details">      

       Employee email -  {!Employee__c.Emp_Email__c}       

   </apex:pageBlock>   

   <apex:detail />  

</apex:page>

 

Any help is much appreciated.

Thanks.

Hi,

 

I have set-up an email alert with some workflow rules. Everything works perfect as set-up except the email alert generates 2 emails.

The receipt receives 2 emails from the app. I have cheked the e-mail alert setting, there is only 1 person set-up to receive the email.

 

The first email is sent as below-

From-  My name

Sent by:     no-reply@salesforce.com

Please respond to     "Email Approval" < the long code>

 

The second email is sent as below-

From- my.organization@mydomain.com

Sent by: no-reply@salesforce.com

 

There is no third line on the second email.

 

The problem here is that-

1. Why 2 emails are generated

2. Why the email from Organization name is missing "Please respond to"

 

Any help is much appreciated.

Thanks.