• 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 need to implement multi language on approx. 17 Visualforce pages, to add support for the Chinese language.
 
I’m struggling to come up with an elegant way to implement this.  It would be nice to have a repository in Salesforce that would tie to text blobs that could be referenced, and the language conversions could be tied into standard Salesforce translation functionality.  I could build my own repository for this, (Which is what I would do if I was building a normal web page) but I’m concerned about the cost in SOQL calls and running into SOQL limits for text translation.  It would also be challenging to have the “hard coded text” for multi languages stored in the controller or another class.  Chances are I'll need to eventually add French, Spanish, etc.
 
I'm going to throw this out on ideas, but I was curious if anyone has figured out an elegant way to do this.  (http://ideas.salesforce.com/article/show/10089968/Best_Practices_Ideas_for_Supporting_MultiLanguage_in_Visualforce)
 
Thanks!
 
Jon Keener
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 created a custom detail page button to go to a Visualforce page by using the following code in an Execute Javascript call:
 
Code:
parent.frames.location.replace("/apex/Sample_Request_Assign_Task_to_CSR_to_Enter_Order—sampleRequestId={!Sample_Request__c.Id}");

 
This is the typical way I've done this in the past for s-controls, etc, so that the outer frames render correctly and you don't get the dual Salesforce tabs.
 
The problem I'm seeing that that the browser "Back" behavior isn't operating the way you would want.  Since the above is doing a replace, the back button is skipping a page, since it was lost with the replace.
 
For Example.
 
On the Home Page - I search for an account
Account List comes up based on Search
I click on the Account I want
I click the button to launch the VF page
 
When I hit the back button, instead of going back to the Account, I go back the the Account List based on the Search
 
My question is whether there is a better way to link to a visualforce page via a Detail button that doesn't cause this behavior?
 
Thanks!
 
Jon Keener
I've been doing most of my development in Firefox, but the end users of this will be in IE. I ran into this during a demo using IE.
 
1. The field help hover is going over the next input field in IE.
2.  To mark columns required, I put the * in the header facet, and made it red.  For some reason, the Font tag isn't working in IE like it does in Firefox
 
 
As a side note, I love it if on an inputField that is a checkbox, we could force the label not to show, as it definitely increases the width of the a data table needlessly.
 
 
 
A snippet of the page code is below:
 
Code:
<apex:dataTable value="{!sampleMaterials}" var="lines" styleClass="list" id="MaterialGrid" rendered="{!IF(ErrorMessage!='','False','True')}">

  <apex:column>
    <apex:facet name="header"><b>Shipping Location <FONT COLOR="#C00" SIZE="4">*</FONT></b></apex:facet>
    <apex:inputField value="{!lines.Shipping_Plant__c}"/>
  </apex:column>

  <apex:column>
    <apex:facet name="header"><b>Material Must Ship from Shipping Location</b></apex:facet>
    <apex:inputField value="{!lines.Material_Must_Ship_from_Shipping_Plant__c}"/>
  </apex:column>

  <apex:column>
    <apex:facet name="header"><b>Estimated Ship Date <FONT COLOR="#C00" SIZE="4">*</FONT></b></apex:facet>
    <apex:inputField value="{!lines.Estimated_Ship_Date__c}"/>
  </apex:column>

</apex:dataTable>


 
Jon Keener
Hi,
 
I've been reading through the documentation and the board for a means of creating a standard input page in VisualForce that populated the form based on the page layout associated with the current user.  It at first seemed that this would be easy, but I haven't found a way to do it.  I at first figured that there might be an attribute on the Detail component to control the mode, so that it would show an input screen for a new record vs. the standard detail screen, based on the page layout of the user.  Unfortunately it doesn't seem to have that capability.  Below is an explaination of what I'm trying to do, so it'll make a little more sense:
 
I've got a Sample Request custom object that has 3 lookup fields on it.  The lookup fields are Account, Contact, and Opportunity.  Both the Account and Contact are required when creating a Sample Request.  The Opportunity is optional.  What I want to do, is add a button on the Sample Request object that will create an Opportunity record and automatically associate the Sample Request with the brand new opportunity.
 
As to the details of what I want to do, they are:
 
1.  Based on the Account the Sample Request is associated with, I can auto determine what RecordType the Opportunity should be, so the user shouldn't have to select RecordType.
2.  I want to present the user with the Input Screen based on the Page Layout.  (We have total of 12 RecordTypes and 14 Page Layouts, with differing required fields/picklists based on the combination, so I want to avoid trying to create a custom form)
3.  After the Opportunity is Saved, I need to update the Sample Request with the new Opportunities Id.
 
 
Another option I could try to implement is to override the Opportunity "Save" button, and have it look for a parameter on the URL of the sampleRequestId.  I haven't tried overriding a "Save" button in this way before, so I'm not sure if this is a good approach or not for this.  I was hoping to be able to make a simple VF page to perform the above so as to limit the exposure of custom logic to only Opportunity Saves that were related to Sample Requests.
 
Any ideas would be great!  Thanks!
 
Jon Keener
 
 
Is there any way to force a Collapsible PageBlockSection to start in a collapsed mode, when the page is rendered?  I know with standard page layouts, this isn't possible, but Salesforce remembers what a user chooses and uses that in the future to determine the collapsible state when rendering a page.  So far, I have not seen this same behavior with Visualforce pages.  It would be nice to have a parameter on the PageBlockSection that controls the initial behavior of a collapsible PageBlockSection when it it first rendered.
 
Jon Keener


Message Edited by Jon Keener on 02-14-2008 01:06 PM
In a form, if an inputField has the parameter ' required="true" ' set, if a commandButton or something else on the page rerenders the section of the page with that inputField, the required validation is performed, regardless of if the immediate="true" switch on the commandButton is used.  So if the inputField is empty at the time this is rerendered, the rerendered version appears with an error below it stating that the field needs to be populated.
 
What I would like to be able to do is to have an option to rerender without this required="true" being validated.  In this specific situation, some buttons on the screen modify the look and feel of the screen, which I do not want to perform this validation.  I only want to perform the validation in this case, being a wizard, when the "next" button is pressed.  This would also be extremely helpful in a wizard for the "previous" button, so that the required logic could be bypassed if going backward in the wizard.
 
Currently the only solution I see to this is to not use the required parameter, place my own red line by my required fields, and perform the required field logic manually, so I can rerender the sections correctly and avoid the messages.  If someone has come across another more elegant approach using the required parameter, please let me know.
 
Thanks!
 
Jon Keener
I'm attempting to use a dataTable to create an entry grid for users to enter 1-many items.  Screenshots and snippets of code are below:
 
The issues I'm having in making this fully functional are:
  1. Enabling the "Delete" button on each line.  To enable this, what would be the optimum answer is having a commandButton Action like:
Code:
<apex:commandButton action="{!RemoveMaterial(lines.index)}" value="Delete" styleClass="btn" rerender="MaterialGrid" immediate="true"/>

The key difference, the RemoveMaterial(lines.index).

So the first question, is there any way to access the actual index of the List in a column of a dataTable?

The second question is passing parameters in the action parameter of the commandButton.  From previous attempts, I've found that I could pass a parameter in an action call, like shown above.  However, the current documentation (Spring 08) states on page 100 - "To add query string parameters to a commandButton, specify them in the associated action method".  Assuming this is true, how do you do this if not like above, and how would you set up the code in the class to access these parameters.

A third item that I ran into, however I'm planning to work around it for now, is if I make any of the inputFields required, when I add a second+ line, when a required field on a previous line is blank, I get the error message popping up stating that the field is required. I'd rather not yell :smileyhappy: at the user to they hit the "next" button (not shown in screenshot, but it's part of a multistep wizard)

I've got some less elegant alternatives for deleting a row that I might try, like placing regular html input buttons instead of commandButtons, etc., but I'm hoping to solve this without resorting to that, because then the code will be a bit bulkier to support this.  Based on the code involved so far, it should be pretty reusable for other grids.

Thanks for any assistance!

Jon Keener


 

, without resorting to Javascript onclick events(which I'm going to be investigating after this, but I foresee some of the same issues there also)

 
 
The Entry form is working nicely and the Add Another Material is working. 
 
 
 
 
Entry Form:
 
Page Snippet
Code:
<apex:pageBlockSection title="Material(s) to be included in Sample:" collapsible="false">
 <apex:dataTable value="{!sampleMaterials}" var="lines" styleClass="list" id="MaterialGrid">
  <apex:column> 
    <apex:facet name="header"><CENTER><b>Actions</b></CENTER></apex:facet>
    <apex:commandButton action="{!RemoveMaterial}" value="Delete" styleClass="btn" rerender="MaterialGrid" immediate="true"/>
  </apex:column> 
  <apex:column> 
    <apex:facet name="header"><b>Material Name</b></apex:facet> 
    <apex:inputField value="{!lines.name}"/>  
  </apex:column>  
  <apex:column>  
    <apex:facet name="header"><b>Sample Quantity</b></apex:facet>
    <apex:inputField value="{!lines.Sample_Quantity__c}"/>  
  </apex:column>  
  <apex:column>  
    <apex:facet name="header"><b>UOM</b></apex:facet>
    <apex:inputField value="{!lines.Sample_UOM__c}"/>  
  </apex:column> 
 </apex:dataTable> 
</apex:pageBlockSection> 

<apex:panelGrid columns="1"> 
    <apex:commandButton action="{!AddNewMaterial}" value="Add Another Material" styleClass="btn" rerender="MaterialGrid" immediate="true"/> 
</apex:panelGrid> 

 Controller Snippet
Code:
List<Sample_Material__c> sampleMaterials;

public List<Sample_Material__c> getSampleMaterials() {
    if (sampleMaterials == null)
       {
       //Initialize the Object
       sampleMaterials = new List<Sample_Material__c>();
       sampleMaterials.add(new Sample_Material__c());
       }
    return sampleMaterials;
}


public void AddNewMaterial() {
    if (sampleMaterials != null)
       {
       sampleMaterials.add(new Sample_Material__c());
       }
}

public void RemoveMaterial() {
}

 
I'm working on a 4 step wizard for the creation of multiple records in Salesforce.
 
In step 1 of the wizard I create a variable for record of the object I'm creating.  Based on information in Step 1, in the "Init" function for step 2, I am able to assign the appropriate recordtype to the variable above.
 
In step 3, there is an inputfield shown for a picklist on the object.  Based on the fact the the recordtypeid field has been previously populated on the object variable, I was hoping that the picklist dropdown would only show the picklist values that have been set to be available for the recordtype assigned to it.  Instead, it is showing the complete list of picklist values.  I've confirmed that the recordtypeid is set properly by using an OutputText field on the same form as the picklist value and I can see that it has the correct recordtypeid.
 
I'm curious if I'm taking the right approach on this and whether this functionality isn't in place yet, or if there is a totally different approach I should be taking to have the correct picklist values become visible.
 
Thanks!
 
Jon Keener
 
 
I was experimenting this morning with trying to return Visualforce markup from a call in the controller.  It almost worked, but it appears that the variable returning the Visualforce markup was resolved after the rest of the APEX was resolved for rendering, so it didn't process the Visualforce. 
 
The purpose of my experimenting is to dynamically build a panelGrid with a differing number of columns (The columns including inputfields) based on prevously selected information on a previous screen of a wizard.
 
A snippet of the Page Code (in this case building the column heading row for a couple of fields):
Code:
<apex:outputLabel value="Shipping Plant" for="Shipping_Plant__c"/>
<apex:panelGroup>
    <apex:outputLabel value="Potential Annual Volume" for="Potential_Annual_Volume__c"/>
    <apex:outputLabel value="UOM" for="Potential_Annual_Volume_UOM__c"/>
</apex:panelGroup>
{!TectylLabel}
<apex:outputLabel value="AD Compound—" for="AD_Compound__c"/>
<apex:outputLabel value="OEM" for="OEM__c"/>

 
For testing, in my Controller, I put the following:
Code:
public String getTectylLabel() {
    return '<apex:outputLabel value="Tectyl Product—" for="Tectyl_Product__c"/>';
}

 
The resulting page ran correctly, but did not rendor the code above, but when I look at the source for that area of the page I see:
Code:
<TD><LABEL for=j_id0:j_id3:j_id4:j_id10:Potential_Annual_Volume__c>Potential 
Annual Volume</LABEL><LABEL 
for=j_id0:j_id3:j_id4:j_id10:Potential_Annual_Volume_UOM__c> UOM</LABEL></TD>

<TD><APEX:OUTPUTLABEL for="Tectyl_Product__c" value="Tectyl Product—" /></TD>

<TD><LABEL for=j_id0:j_id3:j_id4:j_id10:AD_Compound__c>AD Compound–</LABEL></TD>

 
What's interesting is that it did wrap the returned string in a <TD></TD>, but it just treated it as a string. 
 
There may be a way to do this that I'm missing.  I think being able to actually return Visualforce code from an APEX call would be an extremely powerful feature that would increase the ability to dynamically generate the interface.  I'm sure I'll find a way to do what I'm trying to do without this kind of functionality but I figured it would be good to post my findings in case someone else is trying this and has succeeded, or as an idea for future functionality.
 
Jon Keener

 
 
 
I'm trying to get a better understanding of how I might access values on a form that a user has selected prior to a page change or save. 
 
For example, in the code below, I have simple form with one picklist for user input.  I have also added a commandButton that re-renders an output panel below it.  In this sample, the output panel shows an output text area that shows whether the Picklist value is populated and what the value of the picklist currently is.  From what I have been able to tell, I don't have the ability to access the value of the user selected picklist value, because it has not been committed to the object variable, until a page change or save has occurred. 
 
Is there any plans to provide access to this type of information, similar to trigger.old and trigger.new in apex triggers?  I can definitely see value in being able to access the "trigger.old" values if you are editing an existing record, but interface decisions may need to be made based on newly selected values too.
 
As a side note:  I put a call to the Now() function in the Visualforce page to verify that the rerender was occurring.  I was concerned that since I didn't have an action on the button, that maybe the rerender was not running.  The time changes as expected when I press the button.  However, I noticed that the date format returned by Now() does not match the format stated in the current Visualforce documentation.  The documentation states that the Now function returns the date in the GMT timezone, and the example provided shows it including abbreviated day of the week and time down to the seconds.  When I run it, it is showing my current timezone along with not day of the week and time only down to the minutes.
 
 
 
Visualforce Code:
Code:
<apex:page id="step1" controller="testFieldChangeCheck" tabstyle="Contact">
<apex:form>
<apex:pageBlock title="test">
<apex:pageBlockSection title="Test 1">
        <apex:inputField id="picklist1" value="{!testing.LeadSource}" />
</apex:pageBlockSection>
<apex:pageBlockSection title="Test Button" id="TestButton" columns="1">
        <apex:commandButton id="showValues" value="Show Values" immediate="true" rerender="TestPanel">
</apex:commandButton>
</apex:pageBlockSection>

<!-- Test 1 - Test Results -->
<apex:outputPanel id="TestPanel">
<apex:pageBlockSection title="Test Results" id="TestResults" columns="1">
        <apex:outputText value="LeadSource Populated— {!Now()} : {!LeadSourcePopulated} {!testing.LeadSource}">
</apex:outputText>
</apex:pageBlockSection>
</apex:outputPanel>
<!-- End of Test 1 - Test Results -->
</apex:pageBlock>
</apex:form>
</apex:page>

 
Controller Code:
Code:
public class testFieldChangeCheck {
        Contact testing;

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

        public String getleadSourcePopulated() {
                if (testing.LeadSource == null) {return 'No';} else {return 'Yes';}
        }
}

 
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>

 
 

 
Does anyone know what the maximum length of a SessionId from Salesforce is?  I reviewed the API documentation, and I did not see a maximum length stated.  (I reviewed the 7.0 version, since this is the API we are currently using)
 
Thanks for any assistance!
 
Jon Keener
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'm testing a trigger to see if I can block a user attempting to change the owner of an account.  The trigger below is as simple as I can make it, and I receive the error message shown below.  I'm assuming that the error is occurring because account ownership is changed on the view screen, and not the edit screen.  I'm assuming something similar would occur if this type of trigger were attempted on a recordtype change.
 
Thanks for any assistance!
 
Jon Keener
 
 
trigger ChangeAccountOwnerCheck on Account(before update) {
  if (Trigger.old.OwnerId != Trigger.new.OwnerId)
  {
       Trigger.new.OwnerId.addError('Customer ownership is managed by SAP.  Please contact Master Data to make this change.');
  }
}
 
 
 
Error Message:
 
An internal server error has occurred
An error has occurred while processing your request. The salesforce.com support team has been notified of the problem. If you believe you have additional information that may be of help in reproducing or correcting the error, please contact support@salesforce.com. Please indicate the URL of the page you were requesting, any error id shown on this page as well as any other related information. We apologize for the inconvenience.

Thank you again for your patience and assistance. And thanks for using Salesforce!

Error ID: 1788794875-117



Click here to return to the previous page.
 
 
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