• Matt Whalley
  • NEWBIE
  • 85 Points
  • Member since 2014

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 1
    Questions
  • 20
    Replies
Controller:
public class TestRerenderController
{
    public List<String> titles { get; set; }
    public List<VO> vos { get; set; }
    
    public TestRerenderController()
    {
        titles = new String[]{'Title A', 'Title B', ' Title C'};
        
        vos = new List<VO>();
        vos.add(new VO('text a'));
        vos.add(new VO('text b'));
        vos.add(new VO('text c'));
    }
    
    public void hi()
    {
        titles.add('Title D');
        vos.add(new VO('text d'));
    }
    
    public class VO
    {
        public String text { get; set; }
        public VO(String s)
        {
            text = s;
        }
    }
}

VF page:
<apex:page controller="TestRerenderController" id="p">
    <apex:form id="f">
    <apex:pageBlock id="pb">
        <apex:variable value="{!-1}" var="index"/>
        <apex:repeat value="{!titles}" var="title">
            <b>{!title}</b><br/>
            <apex:variable value="{!index+1}" var="index"/>
            <apex:inputText value="{!vos[index].text}"/><br/>
            <apex:commandLink action="{!hi}" value="Add D row" reRender="pb"/>
            <br/><br/>
        </apex:repeat>
    </apex:pageBlock>
    </apex:form>
</apex:page>

Problem 1:
When the commandLink on each row except the last one is clicked, I get a new row but all the input fields reset to their original values. However if I change the value of the last row and click the link on the last row, the value is remembered.

Problem 2:
On click of the link, if I rerender the page instead of pageBlock I don't get a new row. Any ideas why?!

To make it simple you can directly copy/paste above code into your org and test.
I have a multi-section, multi-page word doc that has different headers and footers throughout.  While I can get all that to work, the headers and footers take up space in the body since they print normally - so I set a margin of 10 inches to the side to hide it.  Problem is, it looks like there are blank pages if the hieght of the header and footer is not available in the last page of the section.

So I guess one solution would be is how to not have the headers and footers show up if I don't set the margin to 10 inches to the right.  Here is a code example of a header:

<div style="mso-element:header;margin:0in 0in 0in 10in;" id="h2">
      Some Header Text
</div>

I can get it to work in PDF, but that is not an option.
We are trying to deploy to our production org. All deployments give the following error, no matter which apex classes are being deployed:

Error: Cannot deploy while the apex code is currently executing.

This has been happening all day.
Our suspicion is that there is a stuck deployment from yesterday, but there are no active deployments listed in the org.

Thoughts?
 
I'm trying to present 2 records next to each other using a simple VF page like this:
<apex:page controller="apexdetailissue" id="myPage">
<apex:form>
<apex:panelGrid columns="2" id="theGrid2">
<apex:detail id="myDetailg1" subject="{!Id1}" relatedList="false" inlineEdit="false" />
<apex:detail id="myDetailg2" subject="{!Id2}" relatedList="false" inlineEdit="false" />
</apex:panelgrid>
</apex:form>
</apex:page>

the controller simply returns the Id of 2 accounts: 
public class apexdetailissue{
public Id getId1(){return '0018000000O7t64AAB';}
public Id getId2(){return '0018000000O5bhkAAB';}
}

On the 2 account records there is an embedded VF page:
<apex:page standardController="Account" id="dummypage">
  This is your Dummy VF page
</apex:page>

but it only loads on the leftmost detail and hot on the right most detail.
Note that the Title of this page is teh name of the rightmost account.

It seems to me that the html being generated for the 2 details is ending up with the same id, and the loadign of the 2nd VF pages fails.
Bornstein Seafoods 1:
...
<td class="dataCol col02">Bornstein Seafoods 1&nbsp;<a href="https://na6.salesforce.com/acc/account_hierarchy.jsp?id=0018000000O7t64">[View Hierarchy]</a></td><td class="labelCol">Rating</td><td class="dataCol">&nbsp;</td></tr>
<tr><td class="dataCol col02" colspan="2"><iframe  frameborder="no" height="32px" id="06680000000PkQ2" marginheight="0" marginwidth="0" name="06680000000PkQ2" scrolling="no" title="Dummy" width="100%"></iframe><form  action="https://na6.visual.force.com/servlet/servlet.Integration?lid=06680000000PkQ2&amp;ic=1" id="echoScontrolForm_06680000000PkQ2" method="post" name="echoScontrolForm_06680000000PkQ2" target="06680000000PkQ2" >
...

Bornstein Seafoods 2
...
<td class="dataCol col02">Bornstein Seafoods 2&nbsp;<a href="https://na6.salesforce.com/acc/account_hierarchy.jsp?id=0018000000O5bhk">[View Hierarchy]</a></td><td class="labelCol">Rating</td><td class="dataCol">&nbsp;</td></tr>
<tr><td class="dataCol col02" colspan="2"><iframe  frameborder="no" height="32px" id="06680000000PkQ2" marginheight="0" marginwidth="0" name="06680000000PkQ2" scrolling="no" title="Dummy" width="100%"></iframe><form  action="https://na6.visual.force.com/servlet/servlet.Integration?lid=06680000000PkQ2&amp;ic=1" id="echoScontrolForm_06680000000PkQ2" method="post" name="echoScontrolForm_06680000000PkQ2" target="06680000000PkQ2" >
...

Has anyone solved this?
I've tried to remove the <apex:form>, <apex:panelgrid> etc. it all gives the same result.

Can anyone help?

I borrow  a good part of michalforce receipe (http://www.michaelforce.org/recipeView?id=a0G30000006eVxVEAU) and used this shopping cart code work with creating a case.

So whenever, I added a new product to the shopping cart, the quantity doesn't get saved. The quantity is stored in a wrapper class, and if system.debug upon saving it shows that PricebookEntry object and quantity is in the "shoppingCart2" wrapper list, somehow {!s.productQuantity} in VF isn't being pulled.?

Here is the entire Apex:
public with sharing class InternalFurfillment2 {

    public String searchString {get;set;}

    private List<PriceBookWrapper> forDeletion2 = new List<PriceBookWrapper>();
    public List<PriceBookWrapper> shoppingCart2 {get;set;}
    
    public priceBookEntry[] AvailableProducts {get;set;}
    public String toSelect {get; set;}
    public String toUnselect {get; set;}
    public Boolean overLimit {get;set;}
    
    public string priceBookName = 'Internal Price Book';
    
    private ApexPages.StandardController stdController;    
    private Case caseObject;
      
    public InternalFurfillment2(ApexPages.StandardController controller) {
        this.caseObject = (Case) controller.getRecord();  
        shoppingCart2 = new List<PriceBookWrapper>();

        updateAvailableList();       
    }

    public void updateAvailableList() {
        
        // We dynamically build a query string and exclude items already in the shopping cart
        String qString = 'select Id, Pricebook2Id, IsActive, Product2.Name, Product2.Family, Product2.IsActive, Product2.Description, UnitPrice, Product2.Vendor__c from PricebookEntry where IsActive=true and PricebookEntry.Pricebook2.Name = \'' + priceBookName + '\'';
        system.debug('qString begin==>' + qString);
        // note that we are looking for the search string entered by the user in the name OR description
        // modify this to search other fields if desired
        if(searchString!=null){
            qString+= ' and (Product2.Name like \'%' + searchString + '%\' or Product2.Description like \'%' + searchString + '%\')';
        }
        
        Set<Id> selectedEntries = new Set<Id>();
        
        for(PriceBookWrapper d : shoppingCart2){
            system.debug('d==>' + d);
            selectedEntries.add(d.pbeEntry.Id);
        }
        system.debug('selectedEntries==>' + selectedEntries);
               
        if(selectedEntries.size()>0){
            String tempFilter = ' and Id not in (';
            for(Id i : selectedEntries){
                tempFilter+= '\'' + (String)i + '\',';
            }
            String extraFilter = tempFilter.substring(0,tempFilter.length()-1);
            extraFilter+= ')';
            
            qString+= extraFilter;
        }
        
        qString+= ' order by Product2.Name';
        qString+= ' limit 101';
        
        system.debug('qString:' +qString);        
        AvailableProducts = database.query(qString);
        
        // We only display up to 100 results... if there are more than we let the user know (see vf page)
        if(AvailableProducts.size()==101){
            AvailableProducts.remove(100);
            overLimit = true;
        }
        else{
            overLimit=false;
        }
    }
    
    public void addToShoppingCart(){
        system.debug('AvailableProducts==>' + AvailableProducts);
        system.debug('shopping cart outside top==>' + ShoppingCart2); 
        // This function runs when a user hits "select" button next to a product    
        for(PricebookEntry d : AvailableProducts){
            if((String)d.Id==toSelect){
                shoppingCart2.add(new PriceBookWrapper(d,0)); system.debug('shopping cart inside==>' + ShoppingCart2);
                break;
            }
        }system.debug('shopping cart outside==>' + ShoppingCart2);       
        updateAvailableList();  
    }
    

    public PageReference removeFromShoppingCart(){    
        // This function runs when a user hits "remove" on an item in the "Selected Products" section            Integer count = 0;    
        for(PriceBookWrapper d : shoppingCart2){
            if((String)d.pbeEntry.Id==toUnselect){            
                if(d.pbeEntry.Id!=null)
                    forDeletion2.add(d);            
                shoppingCart2.remove(count);
                break;
            }
            count++;
        }        
        updateAvailableList();       
        return null;
    }
    
    public PageReference onSave(){        
        system.debug('shoppingCart2 submit==>' + shoppingCart2);
               return null;
    }
         
     public class PriceBookWrapper{  
         public Integer productQuantity {get;set;}  
         public PriceBookEntry pbeEntry {get;set;}  
         
         public PriceBookWrapper(PriceBookEntry pbeEntry, Integer productQuantity){  
             this.pbeEntry = pbeEntry;  
             this.productQuantity = productQuantity; 
         }      
    }  
}


The portion of VF that where quantity should be displaying:
..	
<apex:pageBlock title="My Content">	
		<apex:outputPanel id="mainBody">
        
<!-- this is the upper table... a.k.a. the "Shopping Cart"-->
            <!-- notice we use a lot of $ObjectType merge fields... I did that because if you have changed the labels of fields or objects it will reflect your own lingo -->
            <apex:pageBlockSection title="{!$ObjectType.Product2.LabelPlural} Selection" id="selected" columns="1"> 
                <apex:pageBlock title="Selected {!$ObjectType.Product2.LabelPlural}" id="selected">
                <apex:pageblockTable value="{!shoppingCart2}" var="s">
                
                    <apex:column >
                        <apex:commandLink value="Remove" action="{!removeFromShoppingCart}" reRender="selected,searchResults" immediate="true">
                            <!-- this param is how we send an argument to the controller, so it knows which row we clicked 'remove' on -->
                            <apex:param value="{!s.pbeEntry.Id}" assignTo="{!toUnselect}" name="toUnselect"/>
                        </apex:commandLink>
                    </apex:column>
                    
                    <apex:column headerValue="{!$ObjectType.Product2.LabelPlural}" value="{!s.pbeEntry.Product2.Name}"/>
                    
                    <apex:column headerValue="{!$ObjectType.OpportunityLineItem.Fields.Quantity.Label}">
                        <apex:inputText value="{!s.productQuantity}" style="width:70px" required="true" onkeyup="refreshTotals();"/>
                    </apex:column>
                        <!--   -->
             
                    <apex:column headerValue="{!$ObjectType.OpportunityLineItem.Fields.Description.Label}">
                        <apex:outputField value="{!s.pbeEntry.Product2.Family}"/>    
                    </apex:column>
                   
                </apex:pageblockTable>
         </apex:pageBlock>
...


This is the entire VF page:

<apex:form>
	<apex:pageBlock title="My Content">	
		<apex:outputPanel id="mainBody">
			<apex:pageBlockSection title="{!$ObjectType.Product2.LabelPlural} Selection" id="selected" columns="1"> 
                <apex:pageBlock title="Selected {!$ObjectType.Product2.LabelPlural}" id="selected">
                <apex:pageblockTable value="{!shoppingCart2}" var="s">
                
                    <apex:column >
                        <apex:commandLink value="Remove" action="{!removeFromShoppingCart}" reRender="selected,searchResults" immediate="true">
                            <!-- this param is how we send an argument to the controller, so it knows which row we clicked 'remove' on -->
                            <apex:param value="{!s.pbeEntry.Id}" assignTo="{!toUnselect}" name="toUnselect"/>
                        </apex:commandLink>
                    </apex:column>
                    
                    <apex:column headerValue="{!$ObjectType.Product2.LabelPlural}" value="{!s.pbeEntry.Product2.Name}"/>
                    
                    <apex:column headerValue="{!$ObjectType.OpportunityLineItem.Fields.Quantity.Label}">
                        <apex:inputText value="{!s.productQuantity}" style="width:70px" required="true" onkeyup="refreshTotals();"/>
                    </apex:column>
                        <!--   -->
             
                    <apex:column headerValue="{!$ObjectType.OpportunityLineItem.Fields.Description.Label}">
                        <apex:outputField value="{!s.pbeEntry.Product2.Family}"/>    
                    </apex:column>
                   
        </apex:pageblockTable>
    </apex:pageBlock>
    
		<!--this is the lower table: search bar and search results-->
		<apex:pageBlock >          
			<apex:outputPanel styleClass="search">
				Search for {!$ObjectType.Product2.LabelPlural}:
			</apex:outputPanel>

			<apex:actionRegion renderRegionOnly="false" immediate="true">
			
				<apex:actionFunction name="fetchResults" action="{!updateAvailableList}" reRender="searchResults" status="searchStatus"/>
				
				<!-- here we invoke the scripting to get out fancy 'no button' search bar to work -->
				<apex:inputText value="{!searchString}" onkeydown="if(event.keyCode==13){this.blur();}else{resetTimer();}" style="width:300px"/>
				&nbsp;&nbsp;
				<i>
					<!-- actionStatus component makes it easy to let the user know when a search is underway -->
					<apex:actionStatus id="searchStatus" startText="searching..." stopText=" "/>
				</i>
				
			</apex:actionRegion>
		
			<br/>
			<br/>
		
			<apex:outputPanel id="searchResults">
			
				<apex:pageBlockTable value="{!AvailableProducts}" var="a">
				
					<apex:column headerValue="{!$ObjectType.Product2.Fields.Name.Label}" value="{!a.Product2.Name}" />
					
					<apex:column headerValue="{!$ObjectType.Product2.Fields.Family.Label}" value="{!a.Product2.Family}"/>
					
					<apex:column headerValue="{!$ObjectType.Product2.Fields.Description.Label}" value="{!a.Product2.Description}"/>
					
					<apex:column >
						<!-- command button in a column... neato -->
						<apex:commandButton value="Select" action="{!addToShoppingCart}" reRender="selected,searchResults" immediate="true">
							<!-- again we use apex:param to be able to tell the controller which row we are working with -->
							<apex:param value="{!a.Id}" assignTo="{!toSelect}" name="toSelect"/>
						</apex:commandButton>
					</apex:column>
					
				</apex:pageBlockTable>
				
				<!-- We put up a warning if results exceed 100 rows -->
				<apex:outputPanel styleClass="fyi" rendered="{!overLimit}">
					<br/>
					Your search returned over 100 results, use a more specific search string if you do not see the desired {!$ObjectType.Product2.Label}.
					<br/>
				</apex:outputPanel>
				
				</apex:outputPanel>
				</apex:pageBlock>
			</apex:pageBlockSection>
		</apex:outputPanel>

		<apex:pageBlockSectioncolumns="1">
				   <apex:outputPanel layout="block" style="align: center">
			   <apex:commandButton action="{!onSave}" value="Save"/>
			</apex:outputPanel>

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

</apex:page>





  • August 27, 2014
  • Like
  • 0
Controller:
public class TestRerenderController
{
    public List<String> titles { get; set; }
    public List<VO> vos { get; set; }
    
    public TestRerenderController()
    {
        titles = new String[]{'Title A', 'Title B', ' Title C'};
        
        vos = new List<VO>();
        vos.add(new VO('text a'));
        vos.add(new VO('text b'));
        vos.add(new VO('text c'));
    }
    
    public void hi()
    {
        titles.add('Title D');
        vos.add(new VO('text d'));
    }
    
    public class VO
    {
        public String text { get; set; }
        public VO(String s)
        {
            text = s;
        }
    }
}

VF page:
<apex:page controller="TestRerenderController" id="p">
    <apex:form id="f">
    <apex:pageBlock id="pb">
        <apex:variable value="{!-1}" var="index"/>
        <apex:repeat value="{!titles}" var="title">
            <b>{!title}</b><br/>
            <apex:variable value="{!index+1}" var="index"/>
            <apex:inputText value="{!vos[index].text}"/><br/>
            <apex:commandLink action="{!hi}" value="Add D row" reRender="pb"/>
            <br/><br/>
        </apex:repeat>
    </apex:pageBlock>
    </apex:form>
</apex:page>

Problem 1:
When the commandLink on each row except the last one is clicked, I get a new row but all the input fields reset to their original values. However if I change the value of the last row and click the link on the last row, the value is remembered.

Problem 2:
On click of the link, if I rerender the page instead of pageBlock I don't get a new row. Any ideas why?!

To make it simple you can directly copy/paste above code into your org and test.
I have created a salesforce page which displays a datatable that is populated with an Account's activity history.  I have created this table view as opposed to utilizing the related list view because the activity history gets very convoluted with email responses.  The clients have requested a table view in which to filter out emails and other types of activities so that it's much more managable/easier to read. 

In doing my research, I have come to find that the Activity History table is special and cannot be queried directly.  Inconvenient as it is, I went ahead and created a soql query which joins the activity history to the account object as seen below:

[select id, name, ownerid,
            (select id, subject, whoid, whatid, accountid, ownerid, activitydate, description, status, activitytype, istask, CreatedById from ActivityHistories WHERE not(subject like 'mass email%' OR subject like 'pardot list email%') ORDER BY activitydate DESC)
            from account
            where id = :ApexPages.currentPage().getParameters().get('id')]

The query works and I am able to display the data within the table with the exception of two fields, whoid ('name/contact' field) and whatid ('related to' field). When I run this query in the Force.com explorer I clearly see value for those fields populated in the results, however, when I query within the developer console, those fields return null. I am unable to display these fields in my table as they show up null in the result set. Does anyone know why I am unable to get these results within my apex code/visualforce page despite the fact that I can see the results in the force.com explorer? Any help is greatly appreciated.
Hello,

I am fairly new to apex and triggers, and I am having a hard time getting this particular trigger to do what I need it too.  I have looked over it several times and can't understand why it isn't working as I expect.  Any help is greatly appreciated!!

trigger isNewLeadCreated on Campaign_Influence__c (before insert) {
    for(Campaign_Influence__c CI: Trigger.new) {
        if(CI.LeadID__c != null) {
          List<Campaign_Influence__c> siblings = [Select id, new_lead_created__c, campaign_add_date__c from campaign_influence__c where LeadID__c = :CI.LeadID__c order by new_lead_created__c desc];
          List<Lead> parent = [Select id, SR_date_created__c from Lead where id = :CI.LeadID__c];        
        
        
        //If campaign is first campaign, not of the 3 types, not a list, and not setter contact without set.....True
        if(siblings.size() == 0 
            && (CI.campaign__r.type != 'List Upload' 
                || CI.campaign__r.type != 'Other' 
                || CI.campaign__r.type != 'Pricing')
            && CI.campaign__r.List__c != true
            && CI.campaign__r.ADR_Set__c != true ) {
        CI.new_lead_created__c = true;
        }
        
        //If campaign is not first campaign, new lead never checked on other campaigns, not of the 3 types, not a list, and not setter contact without set.....True
        if(siblings.size() > 0
            && Siblings[0].new_lead_created__c != true
            && (CI.campaign__r.type != 'List Upload' 
                || CI.campaign__r.type != 'Other' 
                || CI.campaign__r.type != 'Pricing')
            && CI.campaign__r.List__c != true
            && CI.campaign__r.ADR_Set__c != true ){
        CI.new_lead_created__c = true;
        }    
        
        if(siblings.size() > 0
            && Siblings[0].new_lead_created__c == true
            && CI.campaign__r.type == 'Cold Call') {
        CI.new_lead_created__c = true;
        Siblings[0].new_lead_created__c = false;
        Update Siblings[0];
        }               
}
}
}


  • August 15, 2014
  • Like
  • 0
I have a multi-section, multi-page word doc that has different headers and footers throughout.  While I can get all that to work, the headers and footers take up space in the body since they print normally - so I set a margin of 10 inches to the side to hide it.  Problem is, it looks like there are blank pages if the hieght of the header and footer is not available in the last page of the section.

So I guess one solution would be is how to not have the headers and footers show up if I don't set the margin to 10 inches to the right.  Here is a code example of a header:

<div style="mso-element:header;margin:0in 0in 0in 10in;" id="h2">
      Some Header Text
</div>

I can get it to work in PDF, but that is not an option.
I have a visualforce page for both Task View and Task Edit.  I have added the Attachments related list to the standard page layout and added :

<apex:relatedList list="Attachments" subject="{!$CurrentPage.parameters.id}" />

to the Task View page as a related list.



I can render the related list in the Task Edit page with the same code but I am not able to get the "Attach File" button to show up.  I understand that this should only be visible when the task is being edited.  I have tried updating the visualforce apiversion from 25 to 29 with no luck there either.

Anytime I use "AttachedContentDocuments" or "CombinedAttachments" in place of "Attachments" in the code, I get an error message saying it's not a valid child of the Task object.

Any help would be appreciated.  This should be simple... I guess I am just not seeing it.


  • May 15, 2014
  • Like
  • 0
Hello,

I'm stuck and hoping someone can help. I refreshed my sandbox and I can login via the web but cannot log in via the API. I use Eclipse for Force development and can't reconnect. I also tried via the PHP soapclient - which is what we use internally - and get the same error. Following the refresh I logged in and reset my security token. I've tried this three times but it continues to fail. Like I said, I can log in normally but not through the API so it suggests a problem with the security token or API. I am using a default System Administrator profile that has API Enabled checked by default.

<?php
require_once ('soapclient/SforceEnterpriseClient.php');
define("USERNAME", "jason@finch.com.dev");
define("PASSWORD", "XXXXXXXX");
define("SECURITY_TOKEN", "XXXXXXXXXXXXXXXXXXXXX");
$mySforceConnection = new SforceEnterpriseClient();
$wsdl = 'soapclient/enterprise.wsdl.xml';
$mySforceConnection->createConnection($wsdl);
$mySforceConnection->login(USERNAME, PASSWORD.SECURITY_TOKEN);
$query = "select email from user";
$result = $mySforceConnection->query($query);
print_r($result);
?>

This works on production but fails in the sandbox with the following error:
Fatal error: Uncaught SoapFault exception: [INVALID_LOGIN] INVALID_LOGIN: Invalid username, password, security token; or user locked out. in /Applications/XAMPP/xamppfiles/htdocs/trunk/plugins/system/salesforce/soapclient/SforceBaseClient.php:168

Any other suggestions? 
Have opened a case with Salesforce on this issue but thought I'd reach out to the dev community to see if anyone has any ideas.

Basically the issue occurs when you render a table with a repeating header as a PDF. On the first page the header will be rendered with extra whitespace above. On subsequent pages the header is fine, though in the sample code below that demonstrates the issue I have a border around the table and the top of the border is missing on all pages save the first.

A similar issue occurs with a repeating footer, though in this case the extra whitespace gets added below the footer. The sample code below does not show this behaviour.

One odd thing I've noticed is that if there is sufficient content before the table on the same page the table renders as expected (both first page and all subsequent pages). This can be observed by including the outputPanel in the sample code below.

<apex:page controller="TestPDFController" standardStylesheets="false" showHeader="false" sidebar="false" applyHtmlTag="false" applyBodyTag="false" renderAs="pdf" readOnly="true">
<html>
    <head>
        <style type="text/css">
            @page {
                size: letter portrait;
                margin-top: 1.0in;
                margin-bottom: 1.0in;
                margin-left: 1.0in;
                margin-right: 1.0in;
                counter-increment: page;
                @bottom-right {
                    content: "Page " counter(page)
                }
            }
            body {
                font-family: Arial, sans-serif;
                color: #000;
            }
            .dataTableClass {
                -fs-table-paginate: paginate;
                 border: 1px solid black; 
                 width: 100%;
            }
            .dataTableClass th, .dataTableClass td {
                vertical-align: top;
                text-align: left;
            }
            .dataTableClass .dtColHeader {
                font-size: 9pt;
                font-weight: bold;
            }
            .dataTableClass .dtColData {
                font-size: 9pt;
            }
        </style>
    </head>
  
    <body>
        <apex:outputPanel layout="block" rendered="false">
            <h3>By including these lines the table header...</h3>
            <h3>...renders as expected on all pages</h3>
        </apex:outputPanel>
        <apex:dataTable value="{!accounts}" var="rec" styleClass="dataTableClass" >
            <apex:facet name="header">
                <h3 style="text-align: center;">List of Accounts and Owners</h3>
            </apex:facet>
            <apex:column style="width: 60%;">
                <apex:facet name="header">
                    <apex:outputText value="Account Name" styleClass="dtColHeader" />
                </apex:facet>
                <apex:outputText value="{!rec.Name}" styleClass="dtColData"/>
            </apex:column>
            <apex:column style="width: 40%;">
                <apex:facet name="header">
                    <apex:outputText value="Owner Name" styleClass="dtColHeader" />
                </apex:facet>
                <apex:outputText value="{!rec.Owner.Name}" styleClass="dtColData" />
            </apex:column>
        </apex:dataTable>
    </body>
  
</html>
</apex:page>

public class TestPDFController
{
    public Account[] accounts{get; private set;}

    public TestPDFController()
    {
        init();
    }
  
    private void init()
    {
        this.accounts = [SELECT Id, Name, Owner.Name FROM Account ORDER BY Name LIMIT 100];
    }
}
why i have to maintain code coverage of 75% can anyone please explain me
Hello,

Am getting various enquiries from my colleagues about recording and working with different time values in Salesforce so it's really a trial at the moment.

One of the guys have asked to work in increments of 15. At the moment most of the time based fields are in minutes. Am looking for a formula that rounds up the value to increments in 15. For example

0 to 15minutes = 1
16 to 30minutes = 2
31 to 45minutes = 3
46 to 60minutes = 4
61 to 90minutes = 5
91 to 114minutes = 6
115 to 129minutes = 7

and so on and so forth


Kind Regards

N
Hi All,

I am getting some invalid images at the end of the MS-Word doc like below.

Invalid footer
I am using apex:page tag like below.
<apex:page standardcontroller="Account" contentType="application/msword; charset=Windows-1252" extensions="GenerateReport_BR" language="en" cache="true">

Can any one please let me know where i am doing mistake .

Thanks,
Raj.

  • April 07, 2014
  • Like
  • 0
Hi,

I want to shade all columns in certain rows on a PageBlockTable based on the value of one of the fields in the table. Currently I have achieved this by adding the same StyleClass to each column (see below) which seems really clunky.

Is there a way to apply the StyleClass once for the entire row.

<apex:pageBlockTable value="{!attendees}" var="att" >
                        
                        <apex:column headerValue="First Name" styleClass="{!att.Status__c}">
                            <apex:outputField value="{!att.First_Name__c}"/>
                        </apex:column>
                       
                        <apex:column headerValue="Last Name" styleClass="{!att.Status__c}">
                            <apex:outputField value="{!att.Last_Name__c}"/>
                        </apex:column>
                       
                        <apex:column headerValue="Known As Name" styleClass="{!att.Status__c}">
                            <apex:outputField value="{!att.Known_As__c}"/>
                        </apex:column>
                       
                        <apex:column headerValue="Represents" styleClass="{!att.Status__c}">
                            <apex:outputField value="{!att.Represents__c}"/>
                        </apex:column>
                       
                        <apex:column headerValue="Role" styleClass="{!att.Status__c}">
                            <apex:outputField value="{!att.Role__c}"/>
                        </apex:column>
                       
                        <apex:column headerValue="Status" styleClass="{!att.Status__c}">
                            <apex:outputField value="{!att.Status__c}"/>
                        </apex:column>

</apex:pageBlockTable>



Thanks


I have one apex code <apex:outputfield value="{!pba__Listing__c.Object_description__c}"></apex:outputfield>. The content of this code will always have a diffrent length and goes over 1-3 pages. So its defined as one big body. I want to define the header and footer for each page.
But I cannot figure out how to define this apex code that it finishes at the bottom of each page.  
All submissions I give in for header and footer are just shown up at the first page and on the last page. But not for the pages in the middle. I tried already several instructions to define it but the header and footer always float over the content in the apex code or the other way around. 

Any suggestions how I can solve my problem?

Hello all,

 

I'm using Eclipse Kepler (4.3) and have successfully installed the Force.com plugin. I could even create a project and see all the components. However, everytime I try to access a piece of code or the schema browser, I get an error saying my password is wrong.

 

I check on my org, and my login lists multiple failed logins for 'Invalid Password'. In my project properties on Eclipse, the password and sec token fields are empty - no matter how many times I enter it, it forgets.

 

If it can't remember, I expect it to atleast prompt me each time. Can something be done?

 

Thanks,

LVS

  • July 24, 2013
  • Like
  • 0

I have created a new page and then i m try to override my account tab by navigating to:

Customize | Accounts | Buttons & Links | Standard Buttons & Links | Edit Accounts Tab | Override With | Visual Force Page

 

I cannot see my newly created page here.

However i see it in :

Setup | Develop | Pages.

 

Please help if i am missing anything.

Thanks

Sai

Hello,

 

I'm really excited about SF Content being free for all my users, and I think I have a great way to start using it. We have these PDF reports that go out to our customers, and I'd love it if we could bcc these emails to a Salesforce email address which would grab the attachments and stash them in a workplace (the same workplace for all attachments). I think this should be pretty easy, but I'm not sure where to begin.

 

I know that I'd create an email service, and I'd obviously add that email address to the emails being sent out, and create a new Apex class, but I looked through the Winter '10 API guide and didn't see what kind of calls I'd make - if anyone could give me an idea of what the code would look like, I'd really appreciate it!

 

Help?

Message Edited by Jakester on 12-16-2009 03:29 PM
Have opened a case with Salesforce on this issue but thought I'd reach out to the dev community to see if anyone has any ideas.

Basically the issue occurs when you render a table with a repeating header as a PDF. On the first page the header will be rendered with extra whitespace above. On subsequent pages the header is fine, though in the sample code below that demonstrates the issue I have a border around the table and the top of the border is missing on all pages save the first.

A similar issue occurs with a repeating footer, though in this case the extra whitespace gets added below the footer. The sample code below does not show this behaviour.

One odd thing I've noticed is that if there is sufficient content before the table on the same page the table renders as expected (both first page and all subsequent pages). This can be observed by including the outputPanel in the sample code below.

<apex:page controller="TestPDFController" standardStylesheets="false" showHeader="false" sidebar="false" applyHtmlTag="false" applyBodyTag="false" renderAs="pdf" readOnly="true">
<html>
    <head>
        <style type="text/css">
            @page {
                size: letter portrait;
                margin-top: 1.0in;
                margin-bottom: 1.0in;
                margin-left: 1.0in;
                margin-right: 1.0in;
                counter-increment: page;
                @bottom-right {
                    content: "Page " counter(page)
                }
            }
            body {
                font-family: Arial, sans-serif;
                color: #000;
            }
            .dataTableClass {
                -fs-table-paginate: paginate;
                 border: 1px solid black; 
                 width: 100%;
            }
            .dataTableClass th, .dataTableClass td {
                vertical-align: top;
                text-align: left;
            }
            .dataTableClass .dtColHeader {
                font-size: 9pt;
                font-weight: bold;
            }
            .dataTableClass .dtColData {
                font-size: 9pt;
            }
        </style>
    </head>
  
    <body>
        <apex:outputPanel layout="block" rendered="false">
            <h3>By including these lines the table header...</h3>
            <h3>...renders as expected on all pages</h3>
        </apex:outputPanel>
        <apex:dataTable value="{!accounts}" var="rec" styleClass="dataTableClass" >
            <apex:facet name="header">
                <h3 style="text-align: center;">List of Accounts and Owners</h3>
            </apex:facet>
            <apex:column style="width: 60%;">
                <apex:facet name="header">
                    <apex:outputText value="Account Name" styleClass="dtColHeader" />
                </apex:facet>
                <apex:outputText value="{!rec.Name}" styleClass="dtColData"/>
            </apex:column>
            <apex:column style="width: 40%;">
                <apex:facet name="header">
                    <apex:outputText value="Owner Name" styleClass="dtColHeader" />
                </apex:facet>
                <apex:outputText value="{!rec.Owner.Name}" styleClass="dtColData" />
            </apex:column>
        </apex:dataTable>
    </body>
  
</html>
</apex:page>

public class TestPDFController
{
    public Account[] accounts{get; private set;}

    public TestPDFController()
    {
        init();
    }
  
    private void init()
    {
        this.accounts = [SELECT Id, Name, Owner.Name FROM Account ORDER BY Name LIMIT 100];
    }
}