• Jon Keener
  • NEWBIE
  • 30 Points
  • Member since 2004

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 27
    Questions
  • 15
    Replies
I'm sometimes having a problem with PDF rendering in a Visualforce Page.  Most of the time it works, but in some cases, I get overlapping text like the following:
 
 
 
 
Rendering this same page as a regular VF page draws the page fine in the browser.  It appears to be a data issue of some sort, possibly situations where a single datatable spans multiple pages.  I haven't ran into a scenario yet where the amount of data is low and the overlapping text is occurring.  It isn't as simple as spanning multiple pages causing the problem, because I have a lot of good scenarios where spanning multiple pages works perfectly fine.
 
Below is a snippet of code from the VF page:
 
Code:
            <apex:outputText value="Open Activities" styleClass="subtitle"/>
                 <apex:dataTable value="{!OpenActivities}" var="lines" styleClass="dataTable" columnclasses="lineitems" headerClass="dataTableHeader" id="OpenActivitiesSection" width="100%">
      <apex:column style="width: 250px" >
            <apex:facet name="header"><b>Open Activity Subject</b></apex:facet>
       <apex:outputText value="{!lines.Subject}"/>
      </apex:column>
      <apex:column style="width: 100px" >
            <apex:facet name="header"><b>Assigned To</b></apex:facet>
       <apex:outputText value="{!lines.AssignedToName}"/>
      </apex:column>
      <apex:column style="width: 150px" >
            <apex:facet name="header"><b>Due Date</b></apex:facet>
       <apex:outputText value="{!lines.ActivityDate_Formatted}"/>
      </apex:column>
      <apex:column >
            <apex:facet name="header"><b>Comments</b></apex:facet>
                            <apex:outputText styleClass="item" escape="true" value="{!lines.Comments}"/>
      </apex:column>
     </apex:dataTable>



            <apex:outputText value="Call Reports" styleClass="subtitle"/>
            <apex:outputText value="{!CallReports_Desc}" styleClass="subtitle2"/>
                 <apex:dataTable value="{!CallReports}" var="lines" styleClass="dataTable" columnclasses="lineitems" headerClass="dataTableHeader" id="CallReportsSection" width="100%">
      <apex:column style="width: 150px" >
            <apex:facet name="header"><b>Call Report Date</b></apex:facet>
       <apex:outputText value="{!lines.callReportDate_Formatted}"  />
      </apex:column>
      <apex:column style="width: 100px" rendered="{!Not(CallReports_LimittoOwner)}">
            <apex:facet name="header"><b>Created By</b></apex:facet>
       <apex:outputText value="{!lines.CallReportCreatedByName}"/>
      </apex:column>
      <apex:column style="width: 250px">
            <apex:facet name="header"><b>Subject</b></apex:facet>
       <apex:outputText value="{!lines.Subject}"/>
      </apex:column>
      <apex:column >
            <apex:facet name="header"><b>Comments</b></apex:facet>
                            <apex:outputText styleClass="item" escape="true" value="{!lines.Comments}"/>
      </apex:column>
     </apex:dataTable>


            <apex:outputText value="Opportunities" styleClass="subtitle" rendered="{!IF(Opportunities_Count>0,'true','false')}"/>
                 <apex:dataTable value="{!Account.Opportunities}" var="lines" styleClass="dataTable" columnclasses="lineitems" headerClass="dataTableHeader" id="OpportunitiesSection" width="100%" rendered="{!IF(Opportunities_Count>0,'true','false')}">
      <apex:column >
            <apex:facet name="header"><b>Opportunity Name</b></apex:facet>
       <apex:outputField value="{!lines.Name}"/>
      </apex:column>
      <apex:column >
            <apex:facet name="header"><b>Stage</b></apex:facet>
       <apex:outputField value="{!lines.StageName}"/>
      </apex:column>
      <apex:column >
            <apex:facet name="header"><b>Close Date</b></apex:facet>
       <apex:outputField value="{!lines.CloseDate}"/>
      </apex:column>
      <apex:column >
            <apex:facet name="header"><b>Amount</b></apex:facet>
       <apex:outputField value="{!lines.Amount}"/>
      </apex:column>
      <apex:column >
            <apex:facet name="header"><b>Probability %</b></apex:facet>
       <apex:outputField value="{!lines.Probability}"/>
      </apex:column>
      <apex:column >
            <apex:facet name="header"><b>Competition</b></apex:facet>
       <apex:outputField value="{!lines.Competition__c}"/>
      </apex:column>
      <apex:column >
            <apex:facet name="header"><b>Target Price</b></apex:facet>
       <apex:outputField value="{!lines.Target_Price__c}"/>
      </apex:column>
     </apex:dataTable>

 
 
 
 
Any ideas on what could be causing this type of an issue would be greatly appreciated!
 
Thanks!
 
Jon Keener
I've put together a relatively simple SOQL statement and have ran into an issue with it returning indirectly related tasks.  Tasks where the they are related to the contact related to the account vs. directly related to the account.  Is there a simple adjustment that can be made to the following SOQL statement so that it will return all of the tasks, as you would see on the regular account activity history related list, whether they are directly or indirectly related?
 
Code:
SELECT Id, Name, OwnerID, Owner.Name, RecordTypeId, RecordType.Name, Type,
    (SELECT Id, FirstName, LastName, Title, Phone, Fax, Email, OwnerId, Owner.Name FROM Contacts ORDER BY LastName ASC, FirstName ASC),
    (SELECT Id, Subject, ActivityDate, Description, Status, Type, OwnerId, Owner.Name, CreatedById, CreatedBy.Name FROM Tasks ORDER BY ActivityDate DESC)
  FROM Account 
 WHERE id = :accountId

 
The query above returns all of the tasks that are directly related to the account via the WhatId field, but not those indirectly related through the contact related to the account.
 
Thanks!
 
Jon Keener
I looked through the Apex documentation and I didn't see any methods that return the server the code is executing on. I figure it has to be there and I'm just missing it as this would be required for packaged apps so they scales across all servers.

What I am doing is build a string that is a hyperlink but I need the server instance (na3, cs1) so I can build out the correct link.

opp is a Opportunity object.
String link = 'https://na3.salesforce.com/'+ opp.id;

Hard coding the na3 is not a good solution. Maybe there is some other way to do this?

Perhaps:

String link = opp.getLink();

but I didn't see anything like this.

Thanks for the help.
-Jason
1. SInce upgrading to the latest version that supports v13, I am getting the following warning after doing a "refresh from server":
 
Severity and Description Path Resource Location Creation Time Id
Refresh error: Unable to retrieve file for id Case of type Workflow due to an internal error:1659875132-10 (370857700) Sandbox/src/unpackaged package.xml line 1 1214436401828 129
 
Considering "Case" can be a reserved word, (I remember the things that had to be done with vb.net previously), I'm wondering if it's something to do with that.
 
 
2. At least half of the time at work, I end up timing out when performing a "refresh from server", :create a new sforce project, or try to deploy something to production.  I've got the timeout value set to 600 (the max), but it still happens frequently.  At work, we are going through a proxy that is probably slowing things down a bit, combined with a rather large/complex salesforce configuration (supporting 3000+ users).  I have tried this at home, without a proxy, and it succeeds much more frequently than at work, but I have still gotten timeouts once in a while.  If I edit the "com.salesforce.toolkit.prefs" file directly, can I increase the timeout value to something greater than 600 and will that work? If so, what would be the true maximum value I could use?  My assumption, is that with the continued additions to metadata, which is a great thing, this is only going to go slower for me.
 
Thanks!
 
Jon Keener
I put together the following page/controller as a simple example of the issue that I am seeing.  When I run the following in my developer org (Pre Summer 08), The Visualforce page renders as I would expect, and when I click the "Show Tests" button, both Test 1 and Test 2 are displayed.
 
In our Sandbox with Summer 08, only Test 1 displays when the button is pressed.  For some reason, Test2 is either not being rerendered, or the if statement in the render attribute is not working as it did previously.  If I take test2 out of the pageBlockSectionItem, it renders correctly.
 
This is a simple example set of code to reproduce the issue.  I have a number of much more complex Visualforce pages that depend on the ability to be able to rerender items inside of pageBlockSectionItems similar to this.
 
Does anyone have any ideas on how to resolve the behavior so that the item inside the pageBlockSectionItem rerenders as expected, like the Pre Summer 08? 
 
Thanks!
 
Jon Keener
jhkeener@ashland.com
 
Page
Code:
<apex:page controller="TestController1" tabStyle="Account">
  <apex:form>
    <apex:pageBlock id="block" title="My Content">
      <apex:pageBlockSection title="My Content Section" columns="1">
        <apex:commandButton id="ShowTests" value="Show Tests" action="{!RunShow}" rendered="{!if(TestsVisible=false,'true','false')}" rerender="block,Test1,Test2,ShowTests,HideTests"/>
        <apex:commandButton id="HideTests" value="Hide Tests" action="{!RunHide}" rendered="{!if(TestsVisible=true,'true','false')}" rerender="block,Test1,Test2,ShowTests,HideTests"/>

        <apex:outputText id="Test1" value="Test 1" rendered="{!if(TestsVisible=true,'true','false')}"/>

        <apex:pageBlockSectionItem>
          <apex:outputText id="Test2" value="Test 2" rendered="{!if(TestsVisible=true,'true','false')}"/>
        </apex:pageBlockSectionItem>

      </apex:pageBlockSection>
    </apex:pageBlock>
  </apex:form>
</apex:page>

 
Controller
Code:
public class TestController1 {


Boolean TestsVisible = false;

public boolean getTestsVisible() {
return TestsVisible;
}

public void RunShow() {
TestsVisible = true;
}

public void RunHide() {
TestsVisible = false;
}

}

 
 
 
I'm starting to do some research into what it would take to create a Visualforce popup window similar to the standard salesforce lookup windows.  For now, my intention is to try to come up with a stronger lookup window for one of our custom objects, and at the moment I plant to create a link on a visualforce page to bring the popup up.  (This link will be right next to the existing standard salesforce lookup icon.)
 
I figured I'd start by seeing if anyone else has had any success doing something like this.  The items I am going to tackle first are:
 
1.  Create the popup window.  -  Don't expect this to be a problem.
2.  Pass parameters to the popup through the URL - Don't expect this to be a problem.
3.  Emulate the existing functionality of an existing Salesforce lookup, so that the lookup window will disappear automatically if the parent window is reselected - Not sure how to implement this one yet
4.  Pass a value, in this case, an Id back to the parent window - Not sure how I'm going to do this, but I'm going to attempt to pass some sort of callback function into the popup so it can return a value
 
Being able to do something like this leads to the need to be able to override standard Salesforce lookup functionality.  That way this could be easily implemented on standard pages, in addition to VisualForce pages.
 
If anyone has attempted something like this with Visualforce yet, any learnings would be great!
 
Thanks!
 
Jon Keener
I've been running into some issues with the "onchange" event triggering so I've been working on a simplified version of a form based on another thread (Toggle display based on Picklist selection ) in the Visualforce forum.  I have run into a number of issues and questions surrounding the code below.
 
General Description: The code, as it is right now, does not work as intended. 
The goal of this code is that:
When the LeadSource dropdown is changed to "Web", the "Details" outputPanel should become visible.  Also, when an account is added, the "Details2" outputPanel should appear.  if the LeadSource is changed to something other than "Web", the "Details" outputPanel should disappear, and if the account is removed, the "Details2" outputPanel should disappear.
 
 
1.  Currently, if both InputFields are on the form, neither of the actionSupports appear to be firing correctly.  If the LeadSource is changed to "Web", the "Details" outputPanel does not appear.
 
2.  If I comment out the section for Test 2, between the comments <!-- Test 2 - Using Account --> and <!-- End of Test 2 - Using Account field --> The LeadSource picklist works correctly in Firefox.
 
3.  When number 2 is done, and things are working correctly in Firefox, they do not work in IE6.  (I haven't tried it in IE7 yet)
 
4.  I have not gotten Test 2 to work successfully, even when commenting out Test 1.  My specific concern about Test 2 is when does the "onchange" event fire for a Lookup Field?  I am hoping that it is when the field value changes, and not when I leave to field.  In my real code, I am trying to enable/disable command buttons based on this being populated or not populated.
 
 
Thanks for any assistance!
Jon Keener
 
 
The Page is:
Code:
<apex:page id="step4" controller="testpage" tabstyle="Contact">
<apex:form>

<apex:pageBlock title="test">

<!-- Test 1 - Using Picklist -->
<apex:pageBlockSection title="test 1">
<apex:panelGrid columns="2" columnClasses="labelCol,dataCol">
<apex:outputLabel value="Picklist 1" for="picklist1" />
<apex:outputPanel>
<apex:actionSupport event="onchange" action="{!ToggleTrue}" rerender="details" />
<apex:inputField id="picklist1" value="{!testing.LeadSource}" />
</apex:outputPanel>
</apex:panelGrid>
</apex:pageBlockSection>
<!-- End of Test 1 - Using Picklist -->


<!-- Test 2 - Using Account -->
<apex:pageBlockSection title="test 2">
<apex:panelGrid columns="2" columnClasses="labelCol,dataCol">
<apex:outputLabel value="Parent Account" for="Acct" />
<apex:outputPanel>
<apex:actionSupport event="onchange" action="{!ToggleTrue2}" rerender="details2" />
<apex:inputField id="Acct" value="{!testing.Account}" />
</apex:outputPanel>
</apex:panelGrid>
</apex:pageBlockSection>
<!-- End of Test 2 - Using Account field -->


<apex:outputPanel id="details">
<apex:pageBlockSection title="Details" rendered="{!hideshow}">
<apex:panelGrid columns="2" columnClasses="labelCol,dataCol">
<apex:outputLabel value="Name" for="personname" />
<apex:inputField id="personname" value="{!testing.Ownerid}" required="false" />
</apex:panelGrid>
</apex:pageBlockSection>
</apex:outputPanel>

<apex:outputPanel id="details2">
<apex:pageBlockSection title="Details 2" rendered="{!hideshow2}">
<apex:panelGrid columns="2" columnClasses="labelCol,dataCol">
<apex:outputLabel value="Email" for="Email" />
<apex:inputField id="Email" value="{!testing.Email}" required="false" />
</apex:panelGrid>
</apex:pageBlockSection>
</apex:outputPanel>


</apex:pageBlock>
</apex:form>
</apex:page>

 
The Controller Code is:
 
Code:
public class testpage {

Contact testing;

boolean testval = false;
boolean testval2 = false;

public String ToggleTrue() {
if ( testing.LeadSource =='Web') {
testval = true;
} else { testval = false; }
return null;
}

public Contact gettesting() {
if (testing == null) testing = new Contact();
return testing;
}

public Boolean gethideshow() {
return testval;
}

public String ToggleTrue2() {
if ( testing.Account != null) {
testval2 = true;
} else { testval2 = false; }
return null;
}

public Boolean gethideshow2() {
return testval2;
}


}

 
 
 


Message Edited by Jon Keener on 12-12-2007 11:14 AM
I've begun playing with Visualforce, and I came across something that I haven't been able to figure out, although it seems to me I've got to be missing something pretty obvious.  I want to have an inputField span across two columns, just like on a page layout where the section is set to only have one column.  I haven't been able to reproduce this effect in Visualforce.  I assumed there might be a parameter on the pageBlockSection, or even the inputField, but based on the documentation I am not seeing it.  The only place I saw a mention of column spanning was with the column tag, which only works with the dataTable tag, which isn't for an input form.  I also looked at the panelGrid tag, and couldn't see a way of doing this with it either.
 
Thanks for any assistance.
 
Jon
 
 
Code:
<apex:page standardController="Sample_Request__c">
 <apex:sectionHeader title="New Sample Request" subtitle="Step 1 of 3"/>
 <apex:form>
  <apex:pageBlock title="Sample Information">
   <apex:pageBlockSection title="Ship To Address for Sample" columns="1" collapsible="false">
    <apex:inputField id="addressLine1" value="{!Sample_Request__c.Address_Line_1__c}"/>
    <apex:inputField id="addressLine2" value="{!Sample_Request__c.Address_Line_2__c}"/>
    <apex:inputField id="addressLine3" value="{!Sample_Request__c.Address_Line_3__c}"/>
    <apex:inputField id="addressLine4" value="{!Sample_Request__c.Address_Line_4__c}"/>
   </apex:pageBlockSection>
  </apex:pageBlock>
 </apex:form>
</apex:page>

 
 

 
Hi. Perhaps I am over complicating this. I hope it is something simple I have missed.

Basically, I have a picklist on a page I have created and when the user changes the selection on the picklist I want to either show or hide parts of the screen (using ajax). My code below almost works (i.e.: the javascript function works but for some reason the variable I am storing the current state in appears to lose its value).

I have tried this a variety of ways but it always ends up with the same problem - I can see the value being assigned to the variable testval but when I want to render the section of the screen and make a call to get the testval value, the value has changed to being true all the time.

Can anybody assist?

Code:
<apex:page id="step4" controller="testpage" tabstyle="Enquiry__c">
<apex:form>
<script>
function currentval(id) {
var newval = document.getElementById(id).value;
switch (newval) {
case "1" :
var chgVal = '{!ToggleFalse}';
break;
default :
var chgVal = '{!ToggleTrue}';
break;
}
}
</script>

<apex:pageBlock title="test">
<apex:pageBlockSection title="test">
<apex:panelGrid columns="2" columnClasses="labelCol,dataCol">
<apex:outputLabel value="Picklist 1" for="picklist1"></apex:outputLabel>
<apex:inputField id="picklist1" value="{! testing.xyz__c}"></apex:inputField>
<apex:actionSupport event="onchange" onsubmit="currentval('{!$Component.picklist1}')" rerender="details"></apex:actionSupport>
</apex:panelGrid>
</apex:pageBlockSection>

<apex:outputPanel id="details">
<apex:pageBlockSection title="Details" rendered="{! hideshow}">
<apex:panelGrid columns="2" columnClasses="labelCol,dataCol">
<apex:outputLabel value="Name" for="personname"></apex:outputLabel>
<apex:inputField id="personname" value="{! testing.abcd__c}"></apex:inputField>
</apex:panelGrid>
</apex:pageBlockSection>
</apex:outputPanel>
</apex:pageBlock>
</apex:form>
</apex:page>



Code:
public class testpage {

testing123__c testing;

boolean testval = false;

public String getToggleTrue() {
testval = true;
return null;
}

public String getToggleFalse() {
testval = false;
return null;
}

public testing123__c gettesting() {
if (testing == null) testing = new testing123__c();
return testing;
}

public Boolean gethideshow() {
return testval;
}

}


 


Is there anyway to determine in a before delete trigger if the reason that a delete is because a user is attempting to merge a record, and the record being deleted is the losing record in the merge?  The reason I'm asking, is I would like to show a different error message, depending on the context. (merging, vs. clickling the delete button on the account.)
 
Also, I was thinking about whether there might be value in have "before merge" and "after merge" triggers.  These might be useful, for example, being able to look at something like trigger.old.1.name, trigger.old.2.name, trigger.old.3.name, and trigger.new.name. 
 
Rules could be put in place to not allow certain types of field merges from certain types of records.  For example:
 
1.  I want to allow users to merge prospect recordtype accounts to customer recordtype accounts, but not the reverse.
 
2.  I do not want to allow customer recordtypes to be merged with other customer recordtypes.  (In our case, we have an integration with SAP, and we want SAP to have full control over this)
 
3.  When merging a prospect recordtype to a customer recordtype, I do not want certain fields from prospect records to ever merge to a customer recordtype.  These would typically be fields that are prepopulated on the customer recordtype from our SAP system.
 
 

I was wondering if it was possible to pass an "override" parameter to a report through a weblink.  For example:

I'd like to create a web link on the Account Tab that runs a report that displays all opportunities for that Account.  To do this, I'd have to pass the Account Number as a merge field to the report, and have the report utilize it. 

If anyone has done something like this, please let me know!

Thanks!

Jon Keener

jhkeener@ashland.com