function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
jbozajboza 

Clear stored values before rendering

I am rendering a pdf on a button click. After doing this it will not let me do again as the pdf gives the same information eventhough i have choose a different task to pdf. Is there a way to clear values on the click before updating the values.

Ishan K SharmaIshan K Sharma

Can you clarify your ques little bit more.i am not getting your point

jbozajboza

I render a pdf of a task comments(description) this is actually an email I sent. I am rendering for print purposes. Once I pdf one record I can only get this record. Even if I choose my custom button while viewing another record.

 

Here is my code:

 

Controller:

 

public class TaskController{
public Task tsk{get;set;}    

public TaskController(){        

tsk=[select Description from Task limit 1];        

tsk.Description=tsk.Description.replace('\n','<br/>');         

}

 

VF Page:

 

<apex:page controller="TaskController" showHeader="false" renderAs="PDF">       

<div align="center" width="550px">        

<h1>Current Email</h1>     </div>      

<div align="left" width="550px">         

<apex:outputtext escape="false" value="{!tsk.Description}"></apex:outputtext>                 

</div>        

</apex:page>

Ishan K SharmaIshan K Sharma

This might be the solution if i am getting your point right.

You are not giving the current record id i think

 

 

public class TaskController{
public Task tsk{get;set;}   

public TaskController(){   

String currentId = ApexPages.currentPage().getParameters().get('id');    

tsk=[select Description from Task Where id =:currentId];        

tsk.Description=tsk.Description.replace('\n','<br/>');         

}

you dont have to apply LIMIT now.