• p100
  • NEWBIE
  • 25 Points
  • Member since 2013

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 3
    Replies
Hi

Trying to deploy a number of changes and profiles through a change set, however getting the above error for every profile. Presumably the sandbox is on a newer version. Anyone know how to resolve?

Thanks
  • February 12, 2014
  • Like
  • 0

Hi 

 

Im struggling to get my page to return to the previously selected tab on the click of a button, heres a cut down version of the code:

 

<apex:page controller="tabcontroller">
<apex:form >
  <apex:pageBlock >
  <apex:pageBlockButtons >
      <apex:commandButton action="{!returnToTab}" value="Refresh"/>
  </apex:pageBlockButtons>
  <apex:tabPanel switchType="client" value="{!activeTab}" id="TabPanel"
            tabClass="activeTab" inactiveTabClass="inactiveTab">
            <apex:tab label="Tab 1" name="name1" id="tab1">
            </apex:tab>
            <apex:tab label="Tab 2" name="name2" id="tab2">
            </apex:tab>
  </apex:tabPanel>
  </apex:pageBlock>
</apex:form>
</apex:page>

 controller

public class tabcontroller {
    public string activeTab;
    public PageReference returnToTab() {
        //activeTab = 'name2';
        PageReference pr = ApexPages.CurrentPage();
        pr.getParameters().put('TabPanel','name2');
        return pr.setRedirect(true);
    }


    public String getactiveTab()
    {    
        system.debug(ApexPages.CurrentPage().getParameters().get('TabPanel'));
        return activeTab;
    }
    public void setactiveTab(string activeTab)
    {
        this.activeTab = activeTab;
    }
}

 any ideas how to get this working?

 

Thanks

  • September 30, 2013
  • Like
  • 0

Hi

 

When i add

 

<apex:outputField value="{!Project__c.Owner.Name}"/> 

 

with inline editing, the inline editing doesn't work and i dont get the user lookup option. Its working for all other fields on my page, and ideas how to resolve?

 

Thanks

  • September 19, 2013
  • Like
  • 0

Hi

 

On a VF page that produces a pdf report I have a multiselect list of users that i want to default to the logged in user if they have a particular profile, however, i am getting the error "Attempt to dereference a null object" on the following line:

 

surveyor.add(userinfo.getUserId());

 

The code im using is below, grateful for any pointers where im going wrong.

 

VF:

 

<apex:selectList id="Surveyors" size="1" title="Surveyor" value="{!surveyor}" multiselect="true" style="height:107px">
            <apex:selectOptions value="{!Surveyors}"></apex:selectOptions>
</apex:selectList> 

 Apex:

    public List<String> surveyor;
    public List<String> getSurveyor()
    {
        List<Profile> profile = [Select id,Name from Profile Where Id=:userinfo.getProfileId() limit 1];
            string userProfile = profile[0].Name;
            if(userProfile == 'Surveyor')
            {
                surveyor.add(userinfo.getUserId());
            }
        return surveyor;
    }

 

 

  • August 16, 2013
  • Like
  • 0

Hi

 

Is it possible to fix the colours of a chart on a History object? I'm tracking changes in a picklist field so can set the colours on there, however, these changes do not seem to apply to charts produced off the history object e.g. New Value.

 

Any ideas?

Thanks

  • August 06, 2013
  • Like
  • 0

Hi guys

 

I've set up a report as a custom VF page, with a multiselect field that controls the data that is displayed. All works fine. However, im struggling with setting the List<String> in the test class, i keep getting the 'attempt to dereference a null object' error on the following line in the test class. Any ideas where i'm going wrong? Controllor and test class below.

Thanks for any suggestions.

 

public class RAMSuccessTrackerController {

    public List<Site__c> Records {get;set;}
    public double TotalSales {get;set;}
    public double averageRoce {get;set;}
    public List<Site__c> Totals {get;set;}
    public double averageNPVGI {get;set;}
    public List<String> surveyor { get; set; }
    public integer iBWS {get;set;}
    public integer iLegals {get;set;}
    public integer iPlanning {get;set;}
    
    public PageReference refreshList()
    {
        system.debug(surveyor);
        Records = [Select Site_Reference_Number__c, Name,Surveyor__r.Name, Postcode__c, TypeOfSite__c, Status__c, Launch_Date__c,  GovtRegion__c,Rent__c,TotalSalesPost__c,  
                        (Select MeetingDate__c, RecordType.Name,  TotalSalesPost__c, NPV__c, GrossInvestment__c,NPVGrossInvestment__c, CPAR__c, Tenure__c, Rent__c,SalesAreaPostExcCO__c,ROCE__c  
                            From Financial__r 
                            Where MeetingDate__c <> null and RecordType.Name in ('CCM','CCM Update') 
                            order by MeetingDate__c  desc limit 1), 
                                (Select Risk__c,Launch_Date__c,Launch_FY__c,Launch_Quarter__c, Start_On_Site__c, SDG1__c, SDG2CDG2__c, SDG2R__c, SDG3CDG3__c,aBWS_Licence_Granted__c,aLegalsExchanged__c,  ProjectManager__c, status__c,aObtainPlanningPermission__c 
                                From Investment_Programs__r 
                                where status__c in ('Live','Feasibility','Completed') and Risk__c in('0','25','50','75','100') and Launch_FY__c in ('13/14','14/15')), 
                                InvestmentType__c  
                                From Site__c 
                                	where ID in (Select Site__c 
                                				 from Financial__c 
                                				 	where Recordtype.Name In('CCM','CCM Update'))
                                                    and ID in (Select Site__c from InvestmentProgram__c 
                                                                   where status__c in ('Live','Feasibility','Completed') and Risk__c in('0','25','50','75','100') and Launch_FY__c in ('13/14','14/15')) and Surveyor__c in :surveyor 
                                                                   order by surveyor__c, Launch_Date__c asc limit 999];
         TotalSales = 0;
         averageRoce = 0;
         integer i = 0;  
         double totalNPV = 0;
         double totalGI = 0;
         iBWS = 0;
         iPlanning = 0;
         iLegals = 0;
                                                                
         for(Site__c totals : Records)
         {
             if(totals.Financial__r[0].TotalSalesPost__c != null)
             {
                 TotalSales = TotalSales + totals.Financial__r[0].TotalSalesPost__c;
             }
             if(totals.Financial__r[0].Roce__c != null)
             {
                 averageRoce = averageRoce + totals.Financial__r[0].Roce__c;
                 i++;
             }
             if(totals.Financial__r[0].NPV__c != null && totals.Financial__r[0].GrossInvestment__c != null)
             {
                 totalNPV = TotalNPV + totals.Financial__r[0].NPV__c;
                 totalGI = TotalGI + totals.Financial__r[0].GrossInvestment__c ;
             }
             if(totals.Investment_Programs__r[0].aBWS_Licence_Granted__c != null)
             {
                 iBWS++;
             }
             if(totals.Investment_Programs__r[0].aLegalsExchanged__c != null)
             {
                 iLegals++;
             }
             if(totals.Investment_Programs__r[0].aObtainPlanningPermission__c != null)
             {
                 iPlanning++;
             }
         } 
         averageRoce = averageRoce/i;
         averageNPVGI = (TotalNPV/totalGI)*100;
        return null;
    }
    
    public RAMSuccessTrackerController ()
    {


    }
    public List<SelectOption> getSurveyors()
    {
        List<SelectOption> options = new List<SelectOption>();
        
        for(User users : [Select id, Name from User where Profile.Name = 'Surveyor' and isActive = true  order by Name])
        {
            options.add(new selectOption(users.Id, users.Name));
        }
        
        return options;
    }
}

Test Class

@isTest
private class RAMSuccessTrackerControllerTest {

	
    static testMethod void TestRefresh() {
    	
    	//create data
    	Site__c newSite = TestClassHelper.insertSite();
    	Financial__c newFin = TestClassHelper.insertFinancialRecord(newSite.Id, 'CCM');
    	InvestmentProgram__c newIP = new InvestmentProgram__c();
    	newIP.Site__c = newSite.ID;
    	newIP.PlannedReLaunchDate__c = system.today();
    	newIP.Surveyor__c = newSite.Surveyor__c;
    	 
    	system.debug('SURV --------' + newSite.Surveyor__c);
    	PageReference pg = Page.RAMSuccessTracker;
    	Test.setCurrentPage(pg);
    	RAMSuccessTrackerController con = new RAMSuccessTrackerController();
    	con.getSurveyors();
    	
    	List<User> surveyorUser = [Select name from User where ProfileId =:SystemUtilities.getProfileId(SystemConstants.PROFILE_SURVEYOR) limit 1];
		system.debug('LIST _____ ' + surveyorUser);
		
		String s = '';
		for(User u: surveyorUser)
		{
			s = string.valueOf(u.Name);
		}
		
		con.surveyor.add(s);
    	con.refreshList();
      
    }
}

 

  • July 16, 2013
  • Like
  • 0

Hi

 

As a test im trying to render a pdf as landscape, however the following code does npt work. any ideas?

 

<apex:page renderAs="PDF">

<head>
    <style>
        @page{
            size: landscape;
        }
    </style>
</head>
  <h1>Testing Landscape</h1>
  Rendering PDF as Landscape

</apex:page>

 Thanks

  • May 15, 2013
  • Like
  • 0

Hi

 

I'm tracking a field - status - using history tracking, and i cant figure out how to produce a report that shows some fields from the main object (site) plus just the latest change from the history tracking object for each record.

 

e,g. Site Name - Last Edit Date - Last Edited By - Old Status - New Status

 

Any ideas how to achieve this?

 

Thanks

  • April 07, 2013
  • Like
  • 0

Hi

 

In my trigger im getting the above error when assigning the results of the query to the List. Works fine on individual records but not when updating bulk data. Any ideas where im going wrong? Code below:

 

    if(Trigger.isBefore) 
    {
        if(Trigger.isUpdate)
        {
            string fy;
            system.debug('After UPDATE');  
            
            List<JS_Calendar__c> fyInfo = new List<JS_Calendar__c>();
            fyInfo = [Select Date__c, Financial_Year__c, Quarter__c, Period__c, Week__c 
                                            From JS_Calendar__c 
                                            Where Date__c =:[Select Launch_Date__c 
                                                            from InvestmentProgram__c 
                                                            where Id in: Trigger.newmap.keyset()].Launch_Date__c];
                                                            

 thanks

  • March 14, 2013
  • Like
  • 0

Hi

 

Is it possible to fix the colours of a chart on a History object? I'm tracking changes in a picklist field so can set the colours on there, however, these changes do not seem to apply to charts produced off the history object e.g. New Value.

 

Any ideas?

Thanks

  • August 06, 2013
  • Like
  • 0

Hi guys

 

I've set up a report as a custom VF page, with a multiselect field that controls the data that is displayed. All works fine. However, im struggling with setting the List<String> in the test class, i keep getting the 'attempt to dereference a null object' error on the following line in the test class. Any ideas where i'm going wrong? Controllor and test class below.

Thanks for any suggestions.

 

public class RAMSuccessTrackerController {

    public List<Site__c> Records {get;set;}
    public double TotalSales {get;set;}
    public double averageRoce {get;set;}
    public List<Site__c> Totals {get;set;}
    public double averageNPVGI {get;set;}
    public List<String> surveyor { get; set; }
    public integer iBWS {get;set;}
    public integer iLegals {get;set;}
    public integer iPlanning {get;set;}
    
    public PageReference refreshList()
    {
        system.debug(surveyor);
        Records = [Select Site_Reference_Number__c, Name,Surveyor__r.Name, Postcode__c, TypeOfSite__c, Status__c, Launch_Date__c,  GovtRegion__c,Rent__c,TotalSalesPost__c,  
                        (Select MeetingDate__c, RecordType.Name,  TotalSalesPost__c, NPV__c, GrossInvestment__c,NPVGrossInvestment__c, CPAR__c, Tenure__c, Rent__c,SalesAreaPostExcCO__c,ROCE__c  
                            From Financial__r 
                            Where MeetingDate__c <> null and RecordType.Name in ('CCM','CCM Update') 
                            order by MeetingDate__c  desc limit 1), 
                                (Select Risk__c,Launch_Date__c,Launch_FY__c,Launch_Quarter__c, Start_On_Site__c, SDG1__c, SDG2CDG2__c, SDG2R__c, SDG3CDG3__c,aBWS_Licence_Granted__c,aLegalsExchanged__c,  ProjectManager__c, status__c,aObtainPlanningPermission__c 
                                From Investment_Programs__r 
                                where status__c in ('Live','Feasibility','Completed') and Risk__c in('0','25','50','75','100') and Launch_FY__c in ('13/14','14/15')), 
                                InvestmentType__c  
                                From Site__c 
                                	where ID in (Select Site__c 
                                				 from Financial__c 
                                				 	where Recordtype.Name In('CCM','CCM Update'))
                                                    and ID in (Select Site__c from InvestmentProgram__c 
                                                                   where status__c in ('Live','Feasibility','Completed') and Risk__c in('0','25','50','75','100') and Launch_FY__c in ('13/14','14/15')) and Surveyor__c in :surveyor 
                                                                   order by surveyor__c, Launch_Date__c asc limit 999];
         TotalSales = 0;
         averageRoce = 0;
         integer i = 0;  
         double totalNPV = 0;
         double totalGI = 0;
         iBWS = 0;
         iPlanning = 0;
         iLegals = 0;
                                                                
         for(Site__c totals : Records)
         {
             if(totals.Financial__r[0].TotalSalesPost__c != null)
             {
                 TotalSales = TotalSales + totals.Financial__r[0].TotalSalesPost__c;
             }
             if(totals.Financial__r[0].Roce__c != null)
             {
                 averageRoce = averageRoce + totals.Financial__r[0].Roce__c;
                 i++;
             }
             if(totals.Financial__r[0].NPV__c != null && totals.Financial__r[0].GrossInvestment__c != null)
             {
                 totalNPV = TotalNPV + totals.Financial__r[0].NPV__c;
                 totalGI = TotalGI + totals.Financial__r[0].GrossInvestment__c ;
             }
             if(totals.Investment_Programs__r[0].aBWS_Licence_Granted__c != null)
             {
                 iBWS++;
             }
             if(totals.Investment_Programs__r[0].aLegalsExchanged__c != null)
             {
                 iLegals++;
             }
             if(totals.Investment_Programs__r[0].aObtainPlanningPermission__c != null)
             {
                 iPlanning++;
             }
         } 
         averageRoce = averageRoce/i;
         averageNPVGI = (TotalNPV/totalGI)*100;
        return null;
    }
    
    public RAMSuccessTrackerController ()
    {


    }
    public List<SelectOption> getSurveyors()
    {
        List<SelectOption> options = new List<SelectOption>();
        
        for(User users : [Select id, Name from User where Profile.Name = 'Surveyor' and isActive = true  order by Name])
        {
            options.add(new selectOption(users.Id, users.Name));
        }
        
        return options;
    }
}

Test Class

@isTest
private class RAMSuccessTrackerControllerTest {

	
    static testMethod void TestRefresh() {
    	
    	//create data
    	Site__c newSite = TestClassHelper.insertSite();
    	Financial__c newFin = TestClassHelper.insertFinancialRecord(newSite.Id, 'CCM');
    	InvestmentProgram__c newIP = new InvestmentProgram__c();
    	newIP.Site__c = newSite.ID;
    	newIP.PlannedReLaunchDate__c = system.today();
    	newIP.Surveyor__c = newSite.Surveyor__c;
    	 
    	system.debug('SURV --------' + newSite.Surveyor__c);
    	PageReference pg = Page.RAMSuccessTracker;
    	Test.setCurrentPage(pg);
    	RAMSuccessTrackerController con = new RAMSuccessTrackerController();
    	con.getSurveyors();
    	
    	List<User> surveyorUser = [Select name from User where ProfileId =:SystemUtilities.getProfileId(SystemConstants.PROFILE_SURVEYOR) limit 1];
		system.debug('LIST _____ ' + surveyorUser);
		
		String s = '';
		for(User u: surveyorUser)
		{
			s = string.valueOf(u.Name);
		}
		
		con.surveyor.add(s);
    	con.refreshList();
      
    }
}

 

  • July 16, 2013
  • Like
  • 0

Hi

 

As a test im trying to render a pdf as landscape, however the following code does npt work. any ideas?

 

<apex:page renderAs="PDF">

<head>
    <style>
        @page{
            size: landscape;
        }
    </style>
</head>
  <h1>Testing Landscape</h1>
  Rendering PDF as Landscape

</apex:page>

 Thanks

  • May 15, 2013
  • Like
  • 0