• Onur Kaya
  • NEWBIE
  • 15 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies
I have an inline VF page that has two date fields. I prepopulate the dates and when I click on command button it redirects the page into pdf visualforce page. Everything works fine except parameters picked up in URL in the scond run. 

Here is my controller
 
public class FundReportController {


    public Opportunity TempOpportunity {get;private set;}
    
    public final Fund__c f;
    
    public date beginingDate{
    
    get{
        date currentDate = Date.today();
        date beginingDate;
        integer ThisYear = currentDate.year();
        integer LastYear = currentDate.year() - 1;

        if(currentDate.month() > 9){   
           beginingDate = date.newInstance(ThisYear,10,1);
        }else{
           beginingDate = date.newInstance(LastYear,10,1);
        }
      
        return beginingDate;
        }
    set;
    
    }
    
    public FundReportController(ApexPages.StandardController controller){
     
         this.f = (Fund__c)controller.getRecord();
         
         TempOpportunity = new Opportunity();
         TempOpportunity.FS_Disbursement_Request_Date__c = beginingDate;
         TempOpportunity.Board_Poll_Date__c = date.today();
     
     }
     
     public PageReference FundReportPage(){
     
     Pagereference pagereference=new Pagereference('');
     return null;
     
     
     }
}

This is the Visualforce page.
 
<apex:page standardController="Fund__c" extensions="FundReportController">
  <apex:form>
      <apex:pageBlock title="Sample Title" id="block" mode="edit">
          <table border="1" bordercolor="#E5053A" style="background-color:#D7ECF3" width="100%" >
          <tr>
              <th witdh = "50%">Begining Date</th>
              <th witdh = "50%">Ending Date</th>
          </tr>
          <tr>
              <td><apex:inputField id="BegDate" value="{!TempOpportunity.FS_Disbursement_Request_Date__c}" label="" required="true"/></td>
              <td><apex:inputField id="eEndDate" value="{!TempOpportunity.Board_Poll_Date__c}" label="" required="true"/></td>
          </tr>
          </table>
          <apex:commandButton value="GeneratePDF" action="{!FundReportPage}" onclick="window.open('/apex/FundReport?id={!Fund__c.Id}&BegDate={!TempOpportunity.FS_Disbursement_Request_Date__c}&EndDate={!TempOpportunity.Board_Poll_Date__c}','_blank','height=600,location=no,resizable=yes,toolbar=yes,status=no,menubar=yes,scrollbars=1', 1)"/>
      </apex:pageBlock>
  </apex:form>
  
  
</apex:page>

Thank you in advance,
O Kaya
I have an inline VF page that has two date fields. I prepopulate the dates and when I click on command button it redirects the page into pdf visualforce page. Everything works fine except parameters picked up in URL in the scond run. 

Here is my controller
 
public class FundReportController {


    public Opportunity TempOpportunity {get;private set;}
    
    public final Fund__c f;
    
    public date beginingDate{
    
    get{
        date currentDate = Date.today();
        date beginingDate;
        integer ThisYear = currentDate.year();
        integer LastYear = currentDate.year() - 1;

        if(currentDate.month() > 9){   
           beginingDate = date.newInstance(ThisYear,10,1);
        }else{
           beginingDate = date.newInstance(LastYear,10,1);
        }
      
        return beginingDate;
        }
    set;
    
    }
    
    public FundReportController(ApexPages.StandardController controller){
     
         this.f = (Fund__c)controller.getRecord();
         
         TempOpportunity = new Opportunity();
         TempOpportunity.FS_Disbursement_Request_Date__c = beginingDate;
         TempOpportunity.Board_Poll_Date__c = date.today();
     
     }
     
     public PageReference FundReportPage(){
     
     Pagereference pagereference=new Pagereference('');
     return null;
     
     
     }
}

This is the Visualforce page.
 
<apex:page standardController="Fund__c" extensions="FundReportController">
  <apex:form>
      <apex:pageBlock title="Sample Title" id="block" mode="edit">
          <table border="1" bordercolor="#E5053A" style="background-color:#D7ECF3" width="100%" >
          <tr>
              <th witdh = "50%">Begining Date</th>
              <th witdh = "50%">Ending Date</th>
          </tr>
          <tr>
              <td><apex:inputField id="BegDate" value="{!TempOpportunity.FS_Disbursement_Request_Date__c}" label="" required="true"/></td>
              <td><apex:inputField id="eEndDate" value="{!TempOpportunity.Board_Poll_Date__c}" label="" required="true"/></td>
          </tr>
          </table>
          <apex:commandButton value="GeneratePDF" action="{!FundReportPage}" onclick="window.open('/apex/FundReport?id={!Fund__c.Id}&BegDate={!TempOpportunity.FS_Disbursement_Request_Date__c}&EndDate={!TempOpportunity.Board_Poll_Date__c}','_blank','height=600,location=no,resizable=yes,toolbar=yes,status=no,menubar=yes,scrollbars=1', 1)"/>
      </apex:pageBlock>
  </apex:form>
  
  
</apex:page>

Thank you in advance,
O Kaya
hi Folks,

I want to create a custom button on a custom object to send an email.

I hav modified the URL from previous posts 

location.replace('/email/author/emailauthor.jsp?retURL=/{!pba__Listing__c.Id}&p3_lkid={!pba__Listing__c.Id}&rtype=a09&p24={!pba__Listing__c.Advisor_s_email__c}&retURL=/!pba__Listing__c.Id&p5=&template_id=00X90000000g6KC');
here is the error:

Unable to Access Page
The value of the "rtype" parameter contains a character that is not allowed or the value exceeds the maximum allowed length. Remove the character from the parameter value or reduce the value length and resubmit. If the error still persists, report it to our Customer Support team. Provide the URL of the page you were requesting as well as any other related information.

can any one help with this?

Back
  • October 16, 2014
  • Like
  • 0

I have a very simple Batch class and I am trying to write a unit test to cover it but the execute method in this batch class is never executing. I'm stumped.

 

Batch Class:

global class ideaCleanBatch implements Database.Batchable<sObject>{

global Database.QueryLocator start(Database.BatchableContext bc){
//We want to process all Ideas
return Database.getQueryLocator('select Id from Idea');
}

global void execute(Database.BatchableContext bc, List<sObject> objects){
Set<Id> ideaIds = new Set<Id>();
for(sObject s : objects){
Idea i = (Idea)s;
ideaIds.add(i.Id);
}
//Send ideas to ideaClean for processing
ideaClean.recalcNumbers(ideaIds);
}

global void finish(Database.BatchableContext bc){
system.debug('All done.');
}
}

Test Method:

static testMethod void ideaBatchTest(){
List<Idea> ideas = new List<Idea>();
Id communityId = [select Id from Community limit 1].Id;
for(Integer i = 0; i < 200; i++){
ideas.add(new Idea(Title = 'myIdea' + i, CommunityId = communityId));
}
insert ideas;

Test.startTest();
ideaCleanBatch job = new ideaCleanBatch();
ID batchprocessid = Database.executeBatch(job);
Test.stopTest();
}

Coverage:

 

Thanks,

Jason

 

  • October 30, 2009
  • Like
  • 0