• aballard
  • PRO
  • 3128 Points
  • Member since 2006

  • Chatter
    Feed
  • 120
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 703
    Replies

Hi,

 

I know there are plenty of explanations on how to pass a parameter from Salesforce to Apex, but they dont solve my question.

 

I have a button on account, Request Extension, that takes the user to a visualforcepage asking him the reason of the extension. I need to take the answer of the user  and pass it over to another visualforce page. I want to pass the paramenter through the URL.

 

This is my solution that so far I didnt make it work....

 

Visualforce page

 

<apex:page standardController="Account" showHeader="true" showChat="true" tabStyle="Account" extensions="AccountExtension">
    <apex:sectionHeader title="Main Account Extension" subtitle="{!Account.Name}"/>
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockButtons >
                <apex:commandButton value="Next" action="{!EditExtensionData}">
                    <apex:param name="Reason" value="{!Account.Atlas_Code_Usage__c}"/>
                </apex:commandButton>   
                <apex:commandButton value="Cancel" action="{!cancel}"/>
            </apex:PageBlockButtons>
            <div style="position:absolute; top:120px; left:380px;">    
                <apex:outputLabel value="Extension Reason"/>
                <apex:inputField value="{!Account.Atlas_Code_Usage__c}""/>
            </div>
        </apex:pageBlock>
    </apex:form>
</apex:page>

 The field Atlas_Code_Usage will belong to the new Extension account I want to create, not to the one the user starts the wizard from.

 

This is the controller code:

 

public with sharing class AccountExtension {
    private Account acc1;
    private Account acc2;
    
    public AccountExtension(ApexPages.StandardController stdController) {
       this.acc1 = (Account)stdController.getRecord();
       this.acc2= [Select Id,Atlas_Code_Usage__c From Account Where (Id=:acc1.Id)];
    }
    
    public PageReference EditExtensionData()
    {
    	String ExtensionReason = System.currentPageReference().getParameters().get('Reason');
    	PageReference pageRef= new PageReference('/apex/ExtensionData?id='+acc1.Id+'&Reason='+ExtensionReason);
        pageRef.setredirect(true);
        return pageRef;
    }
}

 What I get as result is the following:

 

https://c.cs7.visual.force.com/apex/ExtensionData?id=001M000000Jbe7tIAB&Reason=null

 

Never get a value in the parameter I want to pass over.

 

Really appreciate your help.

 

Regards,

 

Antonio

Lookup inputFields do not display on Visualforce pages if the user doesn't have at least read access to the related object.

 

Is there a way to detect this (interrogate user permissions? check whether the field is displayed?) and rendering appropriately instead of just having a missing field?

 

i.e. If user has object rights, show an inputField, otherwise show explanatory outputText.

 

A VF only solution is preferred rather than javascript or controller side logic.

 

 

I am trying to add a custom DATE/TIME field for display on my visualforce page.  When I add the code, it displays as expected in Developer Mode.

 

 

However, when I log in to the site (Site is linked to the Customer Portal) as any user, that particular field is blank.  All other fields, however, display as expected.

 

 

Can anyone offer any suggestion?  Please let me know if you require any additional info.  Happy to provide.

 

Thanks again!

 

 

When my datatable displays, the proper number of rows is displayed, but each row has the same data in it. 

My controller code:

 

   public class CampaignDetailLine {
        public String IO_Suffix {get; set;}
        public String Description {get; set;} 
        public String Name {get; set;} 
        public String Size {get; set;} 
        public dateTime ServiceDate {get; set;} 
        public dateTime End_Date {get; set;} 
        public Double UnitPrice {get; set;} 
        public Double Quantity {get; set;} 
        public Double TotalPrice {get; set;} 
      
    }
                 
   public  List<CampaignDetailLine> getIOOpportunity() {
           List<CampaignDetailLine> dtlines = new List<CampaignDetailLine>();
           CampaignDetailLine dtline = new CampaignDetailLine();
           
       Opportunity ioopp = [
            SELECT id, name, amount, Ownerid, owner.id, owner.name,
                   Estimated_Revenue_Start_Date__c ,
                   PO__c ,Estimated_Revenue_End_Date__c,
                   Campaign_Details__c ,Billing_Notes__c ,
                   Invoice_Notes__c,
                   AutoIO__c,
                  (SELECT IO_Suffix__c, Description, PricebookEntry.Name,
                           Size__c, ServiceDate, End_Date__c, UnitPrice,
                           Quantity, TotalPrice   
                     FROM OpportunityLineItems order by IO_Suffix__c )
              FROM Opportunity where id = :opp.id];

        for(OpportunityLineItem o : ioopp.OpportunityLineItems) {         
             dtline.IO_Suffix = o.IO_Suffix__c;
             dtline.Description = o.Description;
             dtline.Name = o.PricebookEntry.Name;
             dtline.Size = o.Size__c;
             dtline.ServiceDate = o.ServiceDate;
             dtline.End_Date = o.End_Date__c;
             dtline.UnitPrice = o.UnitPrice;
             dtline.Quantity = o.Quantity;
             dtline.TotalPrice = o.TotalPrice;  

             dtlines.add(dtline); 
        }
                     system.debug(dtlines[0].IO_Suffix);
                     system.debug(dtlines[1].IO_Suffix);
      return dtlines;
    }

I know from the debug statements that each line of dtlines contains a different value. However, when the page displays, I see two lines, each with the content of dtlines[1].

 

 

 My datable

       <apex:dataTable value="{!IOopportunity}" var="item" id="lineItemTable" 
          columns="9" width="100%" 
          columnClasses="sectionDataLeft,sectionDataLeft,sectionDataLeft,sectionDataLeft,sectionDataRight,sectionDataRight,sectionDataRight" 
          border="1"
          cellpadding="3" >

          <apex:column >
                <apex:facet name="header">Line</apex:facet>
                <apex:outputText value="{!item.IO_Suffix}"/>
            </apex:column>
            <apex:column >
                <apex:facet name="header">Description</apex:facet>
                <apex:outputText value="{!item.Description}"/>
            </apex:column>
            <apex:column >
                <apex:facet name="header">Product</apex:facet>
                <apex:outputText value="{!item.Name}"/>
            </apex:column>
            <apex:column >
                <apex:facet name="header">Size</apex:facet>
                <apex:outputText value="{!item.Size}"/>
            </apex:column>

            <apex:column >
                <apex:facet name="header">Start Date</apex:facet>
                <apex:outputText value="{0,date,M'/'dd'/'yyyy}">
                        <apex:param value="{!item.ServiceDate}" />
               </apex:outputText>
            </apex:column>
            
            <apex:column >
                <apex:facet name="header">End Date</apex:facet>
                <apex:outputText value="{0,date,M'/'dd'/'yyyy}">
                        <apex:param value="{!item.End_Date}" />
               </apex:outputText>
            </apex:column>
          
            <apex:column >
                <apex:facet name="header">CPU</apex:facet>
                <apex:outputText value="{!item.UnitPrice}"/>
            </apex:column>
            <apex:column >
                <apex:facet name="header">Quantity</apex:facet>
                <apex:outputText value="{!item.Quantity}"/>
            </apex:column>
            <apex:column >
                <apex:facet name="header">Line Total</apex:facet>
                <apex:outputText value="{!item.TotalPrice}"/>
            </apex:column>

        </apex:dataTable>
     

 I am using a LIST (instead of just returning a SObject)  because later, I intend on adding more rows to this list. But for now, I just want to get this part working.

 

Any help is greatly appreciated.

 

Mike

 

 

I am trying to use JSENCODE to get away from stored XSS security flags. When I use it I get an error  "Incorrect argument type for function 'JSENCODE()'"

 

I am not sure what I am getting wront on this. When I don't use JSENCODE the value comes out but when I wrap it in JSENCODE it gives the error when saving in Eclipse.  Below is my code snippet, thanks for the help in advance.

 

function initialize() {

 

    var myOptions = {

        zoom: 8,

        mapTypeId: google.maps.MapTypeId.ROADMAP,

        mapTypeControl: false

    }

    var locLat = {!JSENCODE(Location__c.Latitude__c)};

    var locLong = {!Location__c.Longitude__c};

    var myLatlng = new google.maps.LatLng(locLat, locLong);

    var infowindow = new google.maps.InfoWindow({

        content: "<b>{!HTMLENCODE(Location__c.Name)}</b><br>" + locLat + "<br>" + locLong

    });

I've been doing some work creating content in Visualforce that is rendered/opened in different formats (PDF, csv, excel etc). The few ways I have found to force rendering or download of the Visualforce page onload is to renderAs="PDF" or setting contenttype="text/csv" etc. The issue is during the load of the page, the page itself is saved using the naming convention of the Visualforce page, meaning you cannot specify the necessary extension. 

 

I was wondering if anyone had a workaround or any ideas to force the save of the page to a dynamic name and specify a file extension (for instance force a Visualforce page named Report with contenttype="application/csv" save as {dynamicname}.csv). 

 

My temporary work-around is having the file emailed as an attachment, as you can specify name of attachment and file extension dynamically in Visualforce templates. I would prefer the option to directly download rather then use this work-around. Anyone have any ideas?

Hi im having problems displaying a RTF Field. For some reason it displays all the HTML tags and i want the field to be displayed exactly as a i saved it when i created the record.

 

VF Code

<apex:page standardController="Noticia__c">
<apex:outputText escape="false">{!Noticia__c.Contenido__c}</apex:outputText>
</apex:page>

 

Thanks for all the help!

I'm creating a DataTable but I will be feeding it data from a created object in my controller but I will not be using the SELECT SQL command.  What kind of object do I have to create in my controller to work with the DataTable?  I'm assuming it's going to be a List, but a list of what?  A list of class objects with just variables?

 

Thanks.

 

P.S.  I'm quite new to Visualforce ... hence this question.

So I've been trying to figure out my fieldset and dynamic binding with vf issue.

 

My goal is to have a Map of lists where each lists contains files. I've been experiencing wierd issues.

 

So I attempted to simplify this. Here's what I'm doing.

 

I create my list (lFields) which contains all the field names I'll be using. I have a pageblock section that displays the value of those fields and a second that just lists all the fields.

 

Then I have a map with 2 keys (List1 and List2) each with a list of fields that's a sub-section of lFields. This I loop through on the page. However if I try to put the field in an Output or Input I get this "Invalid Field Core." If I just display {! f} I get the fieldname just fine.

 

Here's my Extension:

public class Admin_FieldSetTest {
    
    public list<string> lFields {get;set;}
    public list<string> lTemps {get;set;}
    public map<string, list<string>> mLists {get;set;}
    public string ConId; 
    private final Case myCase;
    
    public Admin_FieldSetTest(ApexPages.StandardController controller){    
        ConId = controller.getId();
        BuildFieldList();
        controller.addfields(lFields);
        this.mycase = (Case)controller.getrecord(); 
    }
    public void BuildFieldList(){
        //SELECT AccountId,Budget__c,CaseNumber,ContactId,Id,Origin,OwnerId,Physician_List_Format__c,RecordTypeId,Status,Subject FROM Case
        lFields = new list<string>{'AccountId','CaseNumber','Status','Subject','Physician_List_Format__c'};
        ltemps = new list<string>{'AccountId','CaseNumber','Status','Subject','Physician_List_Format__c'};
        mLists = new map<string, list<string>>();
        mLists.put('List1', lTemps);
        ltemps = new list<string>{'Origin', 'OwnerId', 'RecordTypeId','ContactId','Budget__c'};
        mLists.put('List2', lTemps);    
        lFields.add('Origin');lFields.add('OwnerId'); lFields.add('RecordTypeId');lFields.add('ContactId'); lFields.add('Budget__c');   
        for(string s : lFields){
            boolean Matches = false;
            for(string p : mLists.get('List1')){
                if(s.equals(p)){Matches=true;} 
            }
            for(string p : mLists.get('List2')){
                 if(s.equals(p)){Matches=true;}           
            }                
            system.debug('value of: ' + s + ' has a Match: ' + Matches);
            system.assert(Matches,'Match Failure on value: ' + s);
        }
        
    }
}

 And the page:

 

<apex:page standardController="Case" extensions="Admin_FieldSetTest">
<apex:form >
    <apex:pageblock title="The Lists" >
        
        <apex:pageblocksection title="All the Fields" columns="2">
            <apex:repeat value="{!lFields}" var="f">
           <apex:outputfield value="{!Case[f]}" />            
            </apex:repeat>           
        </apex:pageblocksection>
        
    <apex:pageblocksection title="Field List" >
            <apex:repeat value="{!lFields}" var="f">
            {!f}          
            </apex:repeat>           
        </apex:pageblocksection>
        <apex:repeat value="{!mLists}" var="m">
            <apex:pageBlockSection title="{!m}" columns="2">
                <apex:repeat value="{!mLists[m]}" var="f">
                <!-- This Causes my Invalid Field Core Error -->    
                <!-- <apex:outputfield value="{!Case[f]}" /> -->
                    {!f} <!-- This Works just fine -->
                </apex:repeat>
            </apex:pageBlockSection>
        </apex:repeat>
    </apex:pageblock>
    </apex:form>
</apex:page>

 

Output: Output of page

In case the picture doesn't load: http://twitpic.com/9yo0ja

I am passing a list to a HTML table in a VF controller. 

actionResults = actionResults + '<li>' + sbiA.Name + '</li>';

res.actions = actionResults;

in the VF page 

 

<td>Actions:</td><td>{!res.actions}</td>

 

There is other code too but I am not posting all the code. 

So the problem is that when I view the page I see tags in the OP. 

Like this

<li>Test Action 2</li><li>Test Action</li>

I want it to be displayed like below.. 

 

  • Test Action 2
  • Test Action

 

Hello,

 

I am trying to check the length of a string in a visualforce page but I cannot save the page due to the following error

"Unknown Property. 'String.length'

 

My code is as follows

 

rendered="{!if(selectedItem.length==0)}"

 

I'm sure I must be doing something silly here but I would have thought the length function could have been used within a visualforce apex:outputPanel render check.  Do you notice any typo's above. Missed brackets etc or are string functions just not allowed within a visualforce page?

 

Thanks in advance.

Not sure if I've lost my mind, but I keep getting an error message with this IF statement: 

if (indexOfString > zero)

 

The message is: Save error: Condition expression must be of type Boolean

 

What am I missing???

 

----------------------------------------------------

integer zero = 0;

string myDeveloperName = myUserRoleB.DeveloperName;
integer indexOfString = myDeveloperName.indexOf('_groupshare');

if (indexOfString > zero)
 {
System.debug('#################### ListHeirarchyRoles() MilePost getRolesToShare-0600');
// turn switch to null and get out with UserRole.Id
myUserRoleParentRoleId = null;
myUserRoleId = myUserRoleB.Id;
}
else if (myUserRoleParentRoleId = null)
{
System.debug('#################### ListHeirarchyRoles() MilePost getRolesToShare-0700');
// switch is null - get out with UserRole.Id
myUserRoleId = myUserRoleB.Id;
}

else
{
System.debug('#################### ListHeirarchyRoles() MilePost getRolesToShare-0700');
// get next check ready and keep Parent Role Id active so we stay in the loop
myUserRoleParentRoleId = myUserRoleB.ParentRoleId;
myUserRoleId = myUserRoleB.ParentRoleId;
}

I remember this working previously (or some incarnation thereof), but it's not working now when I'd actually like to use it. Does anyone know what the new method for displaying a dynamic sobject's label is without resorting to a describe call in a controller or extension?

I feel like I periodically run into this issue and feel quite certain that this is a bug. Maybe someone can help.

 

In my controller, I have a Map that looks like this...

 

Map<String, List<CustomObjectWrapper>> objMap;

 My key is a category field for my Custom Object wrapper which looks like this...

 

public class CustomObjectWrapper {
  public boolean selected {get; set;}
  public Custom_Object__c customObject {get; set;}
}

 

 What I am doing in my Visualforce page is create a pageBlockTable for each of the keys (my category) in the map. The values are put into a table and the Description__c field is available for editing. Here is an example.

 

<apex:repeat value="{!objMap}" var="category" >
  <apex:pageBlock title="Category: {!category}">
    <apex:pageBlockTable value="{!objMap[category]}" var="obj">
      <apex:column value="{!obj.customObject.Name}" />
      <apex:column value="{!obj.customObject.Category__c}" />
      <apex:column headerValue="Description">
        <apex:inputField value="{!obj.Description__c}"/>
      </apex:column>
    </apex:pageBlockTable>
  </apex:pageBlock>
</apex:repeat>

 

Now here is the weird part...

 

I have save button on the page that simply updates the records. 99% of the time the records update with no problem. However, when there are two keys in the map of category "VOE" and "Reference", the controller misplaces the values for the Description__c field. The descriptions get saved on the incorrect records. Anything other than the combination of those two keys works fine! Completely bizarre.

 

I've read a bit about some dynamic VF issues with Maps but I don't see anythin definitive in the "Known Issues" list on the community site. Does anyone know if this is indeed a bug? And if so, are there any workarounds?

Hey elite devs!

 

I've used wrapper classes before, but I have to say I'm absolutely stumped why I'm having problems with a wrapper class I've implemented recently for a Visualforce page.  I'd really appreciate another set of eyes on this issue.

 

The class displays a list of OpportunityContactRoles attached to an Opportunity Id in the URL, and displays them with checkboxes next to them for user-selection.

 

Stripped down class:

 

public class FulfillmentEmailController {
	
    public List <utilityContact> opportunityContactRoleList {get; set;}
    
    //Returning a list of Contact Roles related to this Opp
    public List <utilityContact> getRelevantOpportunityContactRoles() { 
        
        if (opportunityContactRoleList == null){
        	
           opportunityContactRoleList = new List <utilityContact> ();
        
           for (OpportunityContactRole eachOpportunityContactRole : [SELECT Id, ContactId, Role, Contact.Name, Contact.Email FROM OpportunityContactRole WHERE OpportunityId = :ApexPages.currentPage().getParameters().get('oppId')]){
                	
           	opportunityContactRoleList.add(new utilityContact(eachOpportunityContactRole));
                
            }
            
        }
        
        return opportunityContactRoleList;
        
    }
	
    public class utilityContact {
        
        public OpportunityContactRole oppCon {get; set;}
        public Boolean selected {get; set;}
        
        public utilityContact(OpportunityContactRole thisOpportunityContactRole) {
            oppCon = thisOpportunityContactRole;
            selected = false;
        }
        
    }

}

 

Visualforce example:

 

<apex:page controller="FulfillmentEmailController" tabStyle="Opportunity">
    <apex:form >
    	<apex:pageBlock title="Select Recipients">
            <p>Please check the contacts you would like to include.</p>
            <br />
            <apex:pageBlockTable value="{!RelevantOpportunityContactRoles}" var="c">
	            <apex:column>
	            	<apex:inputCheckbox value="{!c.selected}" />
	            </apex:column>
	            <apex:column value="{!c.oppCon.Contact.Name}"/>
	            <apex:column value="{!c.oppCon.Contact.Email}"/>
	            <apex:column value="{!c.oppCon.Role}"/>
        	</apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>

 

I should make it clear that I've implemented code EXACTLY like this in another file-- just using different field names and such.  It works without a hitch.

 

However, when I try to run this, I get the following error:

 

     Invalid field selected for SObject Contact

     (or if I comment out the "selected" field....) Invalid field oppCon for SObject Contact

 

I've done some debugging on this, and it's clear the utility class is populating correctly.  If I change the Visualforce columns to simply {!c}, here's an example of what is displayed:

 

utilityContact:[oppCon=OpportunityContactRole:{Role=District Site Coordinator, ContactId=0035000000W0gGcAAJ, Id=00K50000009YJtFEAW}, selected=false]

 

This shows me that the wrapper class is working fine, and that it's correctly populating the fields I'm trying to query.

 

So why am I getting this error?!  Why "Contact" and not OpportunityContactRole?  Why does a different Visualforce page where I use this exact same logic (also querying OpportuntiyContactRoles) work, but this page doesn't?

 

Help me, elite devs!

  • April 28, 2012
  • Like
  • 0

Hello.

I have a VF page that displays 2 lists via the apex:repeat method. The items on the list can be deleted when clicking on a link that invoked the following method:

public PageReference deleteAdditionalCategory(){
        PageReference p = null;
        try{
            String categoryId = ApexPages.currentPage().getParameters().get('CategoryID');
            if(vendorAccountMembershipDetails != null && categoryId != null){
                Category__c c = mapCatList.get(categoryId);
                if(c != null){
                  mapCatList.remove(c.Id);
              	  
              	  Integer lSize = 0;
                  if(addCat != null && addCat.size() > 0){
                  	lSize = addCat.size();
                	for(Integer i=0; i < lSize; i++){
	                	if(addCat[i].Id == c.Id)
	                		addCat.remove(i);
	                		//catList.remove((i+1));
                	}
                  }
                  if(catList != null && catList.size() > 0){
                  	lSize = catList.size();
                	for(Integer j=1; j < lSize; j++){
	                	if(catList[j].Id == c.Id)
	                		catList.remove(j);
                	}
                  }
                  delete c;
                }
            }
            goAction();
        }catch(Exception e){
            ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.ERROR,'Exception - ' +e.getMessage());
            ApexPages.addMessage(msg);
            system.debug('------Exception caught----'+e);
            if(vendorAccountMembershipDetails != null){
                //sendExceptionEmail(vendorAccountMembershipDetails, e);
            }    
        }
        
        return p;
    }

 

 The problem is, the first list (addCat) gets updated but the second one (catList) doesn't. The difference between the two lists is that addCat contains all additional categories associated with a membership order form while catList contains all additional categories plus the primary category. This way, catList will always be larger by 1.

The error I am getting is: Exception - List index out of bounds: followed by the index number of the item I am trying to remove from the list. Here's the odd part... The method will correctly remove items from the lists if I am removing the item at the end of the list. If I try deleting something in the middle, that's when the exception happens.

  • April 23, 2012
  • Like
  • 0

Hi,

 

I have visualforce page which uses custom settings as select list and when I select few of the names then those needs to be displayed.

I have shown the select opions but I am not able to see the selected values in the output. (ie., after the message "You have chose"  I am not getting any output.

 

CODE

--------

a) controller class


public class customsettingcontroller {

public string ISOSelected {get;set;}

    public PageReference test() {
        return null;
    }

public list<SelectOption> getISOCodes() {
    List <SelectOption> listCodes = new List<SelectOption>();
    for (Country_Code__c cCode : Country_Code__c.getAll().values())     
      listCodes.add(new selectoption(cCode.ISO_Code__c, cCode.Name+'--'+cCode.ISO_Code__c));
        return listCodes;
 }
 
}

 

b) visualforce page

 

<apex:page controller="customsettingcontroller">
 <apex:form >
  <apex:pageBlock title="Country Codes">
     <apex:selectList value="{!ISOSelected}" multiselect="true">
         <apex:selectOptions value="{!ISOCodes}"></apex:selectOptions>         
     </apex:selectList>
     <apex:actionSupport event="onselect" action="{!test}" rerender="output" status="status"/>     
  </apex:pageBlock>
 </apex:form>
 <apex:outputPanel id="output">
     <apex:actionStatus id="status" startText="testing...">
        <apex:facet name="stop">
          <apex:outputPanel >
          You have chose:
            <apex:dataList value="{!ISOSelected}" var="a">{!a}</apex:dataList>
          </apex:outputPanel>
        </apex:facet>
     </apex:actionStatus>
 </apex:outputPanel>
</apex:page>

 

Please help me on this.

 

Thanks,

JBabu.

  • April 18, 2012
  • Like
  • 0

In my dataTable, the following WORKS how I expect:

 

                    <apex:column value="{!a.maxStage}">
                        <apex:facet name="header">
                            <apex:commandLink action="{!sortAccounts_maxStage}" value="Stage" reRender="accountTable" status="accountsTableAjaxStatus" />                            
                        </apex:facet>
                    </apex:column>

 

However, if I add even a SINGLE character after the commandLink, the whole commandLink stops rendering:

 

                     <apex:column value="{!a.maxStage}">
                        <apex:facet name="header">
                            <apex:commandLink action="{!sortAccounts_maxStage}" value="Stage" reRender="accountTable" status="accountsTableAjaxStatus" />
                            x
                        </apex:facet>
                    </apex:column>

 

Note the added "x".  Same behavior if I wrap the "x" in a SPAN tag or apex:outputText/etc.

 

Any ideas why?  I already tried forcing rendering with rendered="true" on the facet.

I'm in a sandbox and trying to create a Detail Page Button on the Account page that opens my new VisualForce page.  I've created the page in Developer Mode by navigating to "/apex/newpagename" and clicking "Create the page".  It is the default page created by doing this  ("Congratulations  This is your new Page: newpagename").  

 

Then I went to Customize / Accounts / Buttons and Links and clicked the New button to create a new Custom button, and selected Content source = VisualSource page.  According to the instructions in the VisualForce workbook I should then be able to choose my page in the "Content" dropdown.  But, the dropdown is empty.

 

What am I missing?

 

Thanks, Dave

I was looking at this VF page which pops up a new vf page,Can someone tell me how it works.I understand the VF part but i have questions in javascript.

 

what is 'openPopup' and 'curPopupWindow' I dont see any functions in the code and they dont look like standard javascript functions. So how is the popup working.

 

 

<apex:page standardController="Task" >

<script type="text/javascript" src="/js/functions.js"></script>

<script type="text/javascript">
var Author = { Attach : { Window : null, At : null}}

Author.Attach.At = function(event) {
      try {
        
        openPopup('{!URLFOR($Page.TestPage)}?pid={‘0000000000’}', 'doc', 480, 540,
            'width=480,height=540,scrollbars=yes,toolbar=no,status=no,directories=no,menubar=no,resizable=1', true);
        Author.Attach.Window = curPopupWindow;      
        
      } catch(e) { }
    }
</script>


<apex:form forceSSL="true" id="theForm">

    <apex:pageBlock mode="edit">
       <apex:pageBlockButtons id="pb_Buttons">
        <input type="button" value="Attach File" title="Attach File (New Window)" class="btn" onclick="Author.Attach.At(event)" />
              </apex:pageBlockButtons>
      </apex:pageBlock>
      </apex:form>
</apex:page>

 

 

public List<Map<String,Object>> getPhoneData() {
   List<Map<String, Object>> mapp = new List<Map<String, Object>>();
   Map<String, Object> temp = new Map<String, Object>{'type' => 'Account Phone', 'count' => new List<Integer>{[select count() from Account where Phone_valid__c = true], [select count() from Account where Phone != null]}};
   mapp.add(temp);
   Map<String, Object> temp1 = new Map<String, Object>{'type' => 'Account Fax', 'count' => [select count() from Account where Fax_valid__c = true]};
   mapp.add(temp1);
   Map<String, Object> temp2 = new Map<String, Object>{'type' => 'Contact Phone', 'count' => [select count() from Contact where Phone_valid__c = true]};
   mapp.add(temp2);
   Map<String, Object> temp3 = new Map<String, Object>{'type' => 'Contact Mobile', 'count' => [select count() from Contact where Mobile_valid__c = true]};
   mapp.add(temp3);
   Map<String, Object> temp4 = new Map<String, Object>{'type' => 'Contact Fax', 'count' => [select count() from Contact where Fax_valid__c = true]};
   mapp.add(temp4);
   Map<String, Object> temp5 = new Map<String, Object>{'type' => 'Contact Home Phone', 'count' => [select count() from Contact where Home_Phone_valid__c = true]};
   mapp.add(temp5);
   Map<String, Object> temp6 = new Map<String, Object>{'type' => 'Contact Other Phone', 'count' => [select count() from Contact where Other_Phone_valid__c = true]};
   mapp.add(temp6);
   Map<String, Object> temp7 = new Map<String, Object>{'type' => 'Lead Phone', 'count' => [select count() from Lead where Phone_valid__c = true]};
   mapp.add(temp7);
   Map<String, Object> temp8 = new Map<String, Object>{'type' => 'Lead Mobile', 'count' => [select count() from Lead where Mobile_valid__c = true]};
   mapp.add(temp8);
   Map<String, Object> temp9 = new Map<String, Object>{'type' => 'Lead Fax', 'count' => [select count() from Account where Fax_valid__c = true]};
       mapp.add(temp9);
   return mapp;
   }
   

 Now I want to iterate over Map in Visualforce Page whic I am doing like this:

 

            <apex:pageBlockTable title="Results" value="{!PhoneData}" var="d" >     
            <apex:column value="{!d['type']}" headerValue="Type" />
            <apex:column value="{!d['count']}" headerValue="Total"/>
           
            <apex:column value="{!d}" headerValue="everything"/>
            
          
            
            </apex:pageBlockTable><br/><br/><br/>

 Now, d['count'] is List. I want 1st value of this list 

 

say d['count'] = [1,2,3]

 

How will i get that value in VF? I tried d['count'].get(0)

Hi Gurus,

 

I am facing problems with overriding "new" button.

 

We are using Professiona Edition. We needed a visualforce page in place of standard "new page".

 

So we created one, and replaced it. but when I am hitting save button, it has standard save function "{!save}", the new record is not being created and it is staying on the same page.

 

I tried to find out if PE allows such thing, and found out that it does allow.

 

Can you guys help me out.

 

i am trying to override standard oppotunity. the code is like this...

<apex:page standardController="opportunity" >
 
 <apex:form id="form00"  title="New Opportunity">
   <apex:pageBlock id="block01">
            <apex:pageBlockButtons >
                <apex:commandButton action="{!save}" value=" Save "></apex:commandButton>
                <apex:commandButton action="{!cancel}" value=" Cancel "></apex:commandButton>
            </apex:pageBlockButtons>
       
       <apex:pageBlockSection id="sec01" title="Opportunity Details" columns="2">
           
           <apex:inputField label="Deal Size" value="{!opportunity.Amount}"/>                      
           <apex:inputField value="{!opportunity.owner.Name} "/>
           <apex:inputField value="{!opportunity.Name} "/>                      
           <apex:inputField value="{!opportunity.Account.Name} "/>
           <apex:inputField value="{!opportunity.StageName}"/>                      
           <apex:inputField value="{!opportunity.Probability}"/>
           <apex:inputField value="{!opportunity.ExpectedRevenue}"/>
           <apex:inputField value="{!opportunity.ForecastCategoryName}" style="width:130px"/>
           <apex:inputField value="{!opportunity.IsPrivate}"/>
           <apex:inputField value="{!opportunity.LeadSource}"/>
           <apex:inputField value="{!opportunity.NextStep}"/>
           <apex:inputField value="{!opportunity.Description}"/>
           
           <apex:inputField value="{!opportunity.type}" style="width:130px"/>
       </apex:pageblocksection>  
        
        
   </apex:pageBlock>
 </apex:form>

</apex:page>

 

 

 

 

 

 

Hi,

 

I know there are plenty of explanations on how to pass a parameter from Salesforce to Apex, but they dont solve my question.

 

I have a button on account, Request Extension, that takes the user to a visualforcepage asking him the reason of the extension. I need to take the answer of the user  and pass it over to another visualforce page. I want to pass the paramenter through the URL.

 

This is my solution that so far I didnt make it work....

 

Visualforce page

 

<apex:page standardController="Account" showHeader="true" showChat="true" tabStyle="Account" extensions="AccountExtension">
    <apex:sectionHeader title="Main Account Extension" subtitle="{!Account.Name}"/>
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockButtons >
                <apex:commandButton value="Next" action="{!EditExtensionData}">
                    <apex:param name="Reason" value="{!Account.Atlas_Code_Usage__c}"/>
                </apex:commandButton>   
                <apex:commandButton value="Cancel" action="{!cancel}"/>
            </apex:PageBlockButtons>
            <div style="position:absolute; top:120px; left:380px;">    
                <apex:outputLabel value="Extension Reason"/>
                <apex:inputField value="{!Account.Atlas_Code_Usage__c}""/>
            </div>
        </apex:pageBlock>
    </apex:form>
</apex:page>

 The field Atlas_Code_Usage will belong to the new Extension account I want to create, not to the one the user starts the wizard from.

 

This is the controller code:

 

public with sharing class AccountExtension {
    private Account acc1;
    private Account acc2;
    
    public AccountExtension(ApexPages.StandardController stdController) {
       this.acc1 = (Account)stdController.getRecord();
       this.acc2= [Select Id,Atlas_Code_Usage__c From Account Where (Id=:acc1.Id)];
    }
    
    public PageReference EditExtensionData()
    {
    	String ExtensionReason = System.currentPageReference().getParameters().get('Reason');
    	PageReference pageRef= new PageReference('/apex/ExtensionData?id='+acc1.Id+'&Reason='+ExtensionReason);
        pageRef.setredirect(true);
        return pageRef;
    }
}

 What I get as result is the following:

 

https://c.cs7.visual.force.com/apex/ExtensionData?id=001M000000Jbe7tIAB&Reason=null

 

Never get a value in the parameter I want to pass over.

 

Really appreciate your help.

 

Regards,

 

Antonio

Lookup inputFields do not display on Visualforce pages if the user doesn't have at least read access to the related object.

 

Is there a way to detect this (interrogate user permissions? check whether the field is displayed?) and rendering appropriately instead of just having a missing field?

 

i.e. If user has object rights, show an inputField, otherwise show explanatory outputText.

 

A VF only solution is preferred rather than javascript or controller side logic.

 

 

I am trying to add a custom DATE/TIME field for display on my visualforce page.  When I add the code, it displays as expected in Developer Mode.

 

 

However, when I log in to the site (Site is linked to the Customer Portal) as any user, that particular field is blank.  All other fields, however, display as expected.

 

 

Can anyone offer any suggestion?  Please let me know if you require any additional info.  Happy to provide.

 

Thanks again!

 

 

I was hoping to make <apex:tabPanel> behave nice and select one tab if the app hasn't been set up and the other if it has but ran into two problems:

1) Trying to set selectedTab to a dynamic value doesn't seem to work

2) Using value= doesn't work as then the user can't ever click on the other tab

 

Any tips I'm missing?  I hoped something like this would have worked:

<apex:page id="thePage" controller="controller">
    <apex:tabPanel switchType="client" selectedTab="{!selectedTab}" id="theTabPanel">
        <apex:tab label="One" name="name1" id="tabOne">content for tab one</apex:tab>
        <apex:tab label="Two" name="name2" id="tabTwo">content for tab two</apex:tab>
    </apex:tabPanel>
</apex:page>

And the apex class, where "schedulersActive" is set in another method.  This code works if using value="{!selectedTab}" but not for selectedTab as shown above.

public with sharing class controller{
	public String selectedTab{
		get{
			if (schedulersActive==TRUE)
				return 'name1';

			else
				return 'name2';
			
		}
		set;
	}//getSelectedTab
}

 

When my datatable displays, the proper number of rows is displayed, but each row has the same data in it. 

My controller code:

 

   public class CampaignDetailLine {
        public String IO_Suffix {get; set;}
        public String Description {get; set;} 
        public String Name {get; set;} 
        public String Size {get; set;} 
        public dateTime ServiceDate {get; set;} 
        public dateTime End_Date {get; set;} 
        public Double UnitPrice {get; set;} 
        public Double Quantity {get; set;} 
        public Double TotalPrice {get; set;} 
      
    }
                 
   public  List<CampaignDetailLine> getIOOpportunity() {
           List<CampaignDetailLine> dtlines = new List<CampaignDetailLine>();
           CampaignDetailLine dtline = new CampaignDetailLine();
           
       Opportunity ioopp = [
            SELECT id, name, amount, Ownerid, owner.id, owner.name,
                   Estimated_Revenue_Start_Date__c ,
                   PO__c ,Estimated_Revenue_End_Date__c,
                   Campaign_Details__c ,Billing_Notes__c ,
                   Invoice_Notes__c,
                   AutoIO__c,
                  (SELECT IO_Suffix__c, Description, PricebookEntry.Name,
                           Size__c, ServiceDate, End_Date__c, UnitPrice,
                           Quantity, TotalPrice   
                     FROM OpportunityLineItems order by IO_Suffix__c )
              FROM Opportunity where id = :opp.id];

        for(OpportunityLineItem o : ioopp.OpportunityLineItems) {         
             dtline.IO_Suffix = o.IO_Suffix__c;
             dtline.Description = o.Description;
             dtline.Name = o.PricebookEntry.Name;
             dtline.Size = o.Size__c;
             dtline.ServiceDate = o.ServiceDate;
             dtline.End_Date = o.End_Date__c;
             dtline.UnitPrice = o.UnitPrice;
             dtline.Quantity = o.Quantity;
             dtline.TotalPrice = o.TotalPrice;  

             dtlines.add(dtline); 
        }
                     system.debug(dtlines[0].IO_Suffix);
                     system.debug(dtlines[1].IO_Suffix);
      return dtlines;
    }

I know from the debug statements that each line of dtlines contains a different value. However, when the page displays, I see two lines, each with the content of dtlines[1].

 

 

 My datable

       <apex:dataTable value="{!IOopportunity}" var="item" id="lineItemTable" 
          columns="9" width="100%" 
          columnClasses="sectionDataLeft,sectionDataLeft,sectionDataLeft,sectionDataLeft,sectionDataRight,sectionDataRight,sectionDataRight" 
          border="1"
          cellpadding="3" >

          <apex:column >
                <apex:facet name="header">Line</apex:facet>
                <apex:outputText value="{!item.IO_Suffix}"/>
            </apex:column>
            <apex:column >
                <apex:facet name="header">Description</apex:facet>
                <apex:outputText value="{!item.Description}"/>
            </apex:column>
            <apex:column >
                <apex:facet name="header">Product</apex:facet>
                <apex:outputText value="{!item.Name}"/>
            </apex:column>
            <apex:column >
                <apex:facet name="header">Size</apex:facet>
                <apex:outputText value="{!item.Size}"/>
            </apex:column>

            <apex:column >
                <apex:facet name="header">Start Date</apex:facet>
                <apex:outputText value="{0,date,M'/'dd'/'yyyy}">
                        <apex:param value="{!item.ServiceDate}" />
               </apex:outputText>
            </apex:column>
            
            <apex:column >
                <apex:facet name="header">End Date</apex:facet>
                <apex:outputText value="{0,date,M'/'dd'/'yyyy}">
                        <apex:param value="{!item.End_Date}" />
               </apex:outputText>
            </apex:column>
          
            <apex:column >
                <apex:facet name="header">CPU</apex:facet>
                <apex:outputText value="{!item.UnitPrice}"/>
            </apex:column>
            <apex:column >
                <apex:facet name="header">Quantity</apex:facet>
                <apex:outputText value="{!item.Quantity}"/>
            </apex:column>
            <apex:column >
                <apex:facet name="header">Line Total</apex:facet>
                <apex:outputText value="{!item.TotalPrice}"/>
            </apex:column>

        </apex:dataTable>
     

 I am using a LIST (instead of just returning a SObject)  because later, I intend on adding more rows to this list. But for now, I just want to get this part working.

 

Any help is greatly appreciated.

 

Mike

 

 

I am trying to use JSENCODE to get away from stored XSS security flags. When I use it I get an error  "Incorrect argument type for function 'JSENCODE()'"

 

I am not sure what I am getting wront on this. When I don't use JSENCODE the value comes out but when I wrap it in JSENCODE it gives the error when saving in Eclipse.  Below is my code snippet, thanks for the help in advance.

 

function initialize() {

 

    var myOptions = {

        zoom: 8,

        mapTypeId: google.maps.MapTypeId.ROADMAP,

        mapTypeControl: false

    }

    var locLat = {!JSENCODE(Location__c.Latitude__c)};

    var locLong = {!Location__c.Longitude__c};

    var myLatlng = new google.maps.LatLng(locLat, locLong);

    var infowindow = new google.maps.InfoWindow({

        content: "<b>{!HTMLENCODE(Location__c.Name)}</b><br>" + locLat + "<br>" + locLong

    });

My search and  configuration page is loading three times throughout the configuration process.

1. When the page loads.
2. When I search for results

3. When I select a result and the selection is displayed below the result list.

How can  I disply the selected result without rerendering the page?

VF page:

<apex:page standardcontroller="Customer_Product_Line_Item__c" extensions="AddCustomerProductStage1vfhide1" >

<!-- Javascript function to check all rows in the table -->
<script>
function checkAll(cb)
{
   var inputElem = document.getElementsByTagName("input");
   for(var i=0;i<inputElem.length;i++)https://c.cs4.visual.force.com/s.gif
     {
             if(inputElem[i].id.indexOf("selectLine1")!=-1)
                   inputElem[i].checked = cb.checked;
      }
}
</script>
<!-- End of Javascript function -->
<apex:form >
<apex:pageblock title="Choose Customer Product">
    <!-- Panel grid to display boxes o accept user input values -->
    <apex:panelGrid columns="2">
        <apex:outputLabel style="font-weight:bold;" value="Customer Product" ></apex:outputLabel>
        <apex:inputText value="{!userinput}" />

    </apex:panelGrid>
    <!-- End of panelgrid -->
    <!-- Div to position the commandbutton appropriately -->
        <div style="position:relative;left:75px;">
             <apex:commandButton value="Search" action="{!cpsearch}"  />
        </div>

<!-- Display search results -->
<apex:pageblocksection columns="1" title="Customer Product Search Results" >
  <apex:outputpanel id="Contactlist">

        <apex:pageBlockTable value="{!results}" var="cp" >
             <apex:column width="25px" >
                <apex:outputPanel >
                    <apex:inputCheckbox value="{!cp.selected}" id="selectLine1">
            <apex:actionSupport event="onchange" rerender="thePageBlock"
                                                    status="status"/>
                </apex:inputCheckbox>
              <apex:actionStatus startText="applying value..." id="status"/>
            </apex:outputPanel >
            </apex:column>
            <apex:column headervalue="Customer Product">
                <apex:outputtext value="{!cp.con.Name}"/>
            </apex:column>
        </apex:pageBlockTable>  <br/><br/>
        <div style="position:relative;left:75px;">
             <apex:commandButton value="Create" action="{!processselected}"  />
        </div>
    </apex:outputpanel>
</apex:pageblocksection>

<apex:outputPanel id="thePageBlock">
<apex:pageblocksection title="Attributes for {!pp}">
    <apex:pageblocksection columns="2">
        <apex:inputfield value="{!Customer_Product_Line_Item__c.Condition_1__c}" required="false"/>
        <apex:inputfield value="{!Customer_Product_Line_Item__c.Condition_2__c}" required="False"/>
        <apex:inputHidden />
        <apex:inputfield value="{!Customer_Product_Line_Item__c.Condition_3__c}" required="false"/>
        <apex:inputfield value="{!Customer_Product_Line_Item__c.Shape_1__c}" required="false"/>
        <apex:inputfield value="{!Customer_Product_Line_Item__c.Shape_2__c}" required="False"/>
        <apex:inputfield value="{!Customer_Product_Line_Item__c.Capacity__c}" required="false"/>
        <apex:inputHidden />
        <apex:inputfield value="{!Customer_Product_Line_Item__c.Size__c}" required="false"/>
        <apex:inputHidden />
        <apex:inputfield value="{!Customer_Product_Line_Item__c.Additional_Information__c}" required="false"/>
        <apex:inputHidden />
    </apex:pageblocksection>
</apex:pageblocksection>
</apex:outputPanel>
</apex:pageBlock>


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

 Class

public class AddCustomerProductStage1vfhide1{


/* Constructor Function. The CustomerProduct id is captured in this function */

public Customer_Product_Line_Item__c cpl {get;set;}
public Opportunity o;
public String pp {get;set;}
public AddCustomerProductStage1vfhide1(ApexPages.StandardController c)
{
            o = [select id from Opportunity where id =
                       :ApexPages.currentPage().getParameters().get('oppid')];
}

      public Opportunity getOpportunity() {
            return o;
      }

/* Variable declarations */

public List<cCustomer> cpList {get; set;}                              // Wrapper class which stores customer product data and a boolean flag.
public List<cCustomer> cpsel{get; set;}
public ID oid {get; set;}

public String userinput ='' ;                                                               // cp Name
public String userinp;  

Public List<Customer_Product__c> results = new List<Customer_Product__c>();                 // Customer_Product__c search results.

Public List<Customer_Product__c> selproduct = new List<Customer_Product__c>();                 // Customer_Product__c selectedproduct.

/* End of Variable declarations */

/* Getter and setter methods for getting the user input ie. Customer_Product__c name from the UI */

public String getuserinput(){return userinput;}
public void setuserinput(String userinp1)
{

this.userinput=userinp1;
system.debug('*****SFDC-TEST-1**********'+userinput+'='+userinp);
}
public String getselproduct(){return null;}

/*End of Getter and Setter methods */

/* Method to Search the Customer_Product__c database to return the query results */
public List<Customer_Product__c> cpsearch()
{
     cpList = new List<cCustomer>();
     for(Customer_Product__c c : [select id, name from Customer_Product__c where Name like :userinput+'%' order by Name asc])
     {
      cCustomer c1=new cCustomer(c);
      c1.Selected=false;
       //  cpList.add(new cCustomer(c));
      cpList.add(c1);
      }
system.debug('*****SFDC-TEST-2**********'+cpList);
 if(Test.isRunningTest())
 { getuserinput();
    getopportunity();
   getselproduct();
     }
return null;
}
/* End of method */


/* Method for returning the Customer Product search results to the UI */
public List<cCustomer> getresults()
{
 if(Test.isRunningTest())
 { 
 cpsearch();
 }
  
  System.debug('$$$$$$$$'+cpList);
  return cpList; 

}
    public PageReference processSelected() {

         //We create a new list of Customer Products that we be populated only with Customer Products if they are selected
        List<Customer_Product__c> selectedProduct = new List<Customer_Product__c>();
       System.debug('%%%%%%%%%%%%'+getresults());
        //We will cycle through our list of cCustomer and will check to see if the selected property is set to true, 
        //if it is we add the Customer Product to the selectedProduct list
        for(cCustomer cCon : getresults()) {
        
        System.debug('#####'+cCon.selected);
            if(cCon.selected == true) {
                selectedProduct.add(cCon.con);              
            }
        }
  
  if(test.isRunningTest()){
   getresults();
   
}
      
          
system.debug('*****SFDC-TEST-3**********'+selectedProduct);
        // Now we have our list of selected products and can perform any type of logic we want
        System.debug('These are the selected Products...');
        for(Customer_Product__c cCon : SelectedProduct ) {
            system.debug(cCon);
            
            selproduct.add(cCon);
        }
         system.debug('*****SFDC-TEST-4**********'+selproduct.size());

    cpsel = new List<cCustomer>();
     for(Customer_Product__c p : [select name from Customer_Product__c where id =:selproduct])
     {
     cpsel.add(new cCustomer(p));
      pp =p.name;   
     }return null;

    }


/* Wrapper class to contain customer product record and a boolean flag */
public class cCustomer{
public Customer_Product__c con {get; set;}
public Boolean selected {get; set;}

public cCustomer (Customer_Product__c c)
{
     con = c;
     selected = false;
      }
}

/* end of Wrapper class */    

}

 

I've been doing some work creating content in Visualforce that is rendered/opened in different formats (PDF, csv, excel etc). The few ways I have found to force rendering or download of the Visualforce page onload is to renderAs="PDF" or setting contenttype="text/csv" etc. The issue is during the load of the page, the page itself is saved using the naming convention of the Visualforce page, meaning you cannot specify the necessary extension. 

 

I was wondering if anyone had a workaround or any ideas to force the save of the page to a dynamic name and specify a file extension (for instance force a Visualforce page named Report with contenttype="application/csv" save as {dynamicname}.csv). 

 

My temporary work-around is having the file emailed as an attachment, as you can specify name of attachment and file extension dynamically in Visualforce templates. I would prefer the option to directly download rather then use this work-around. Anyone have any ideas?

Hi im having problems displaying a RTF Field. For some reason it displays all the HTML tags and i want the field to be displayed exactly as a i saved it when i created the record.

 

VF Code

<apex:page standardController="Noticia__c">
<apex:outputText escape="false">{!Noticia__c.Contenido__c}</apex:outputText>
</apex:page>

 

Thanks for all the help!

Hi,

 

my issue is this : I have a simple pageblocktable with some records,when I remove one specific row from the table ... this work well for a moment, then my page is automatically reloaded with the complete pageblocktable and all the rows.

 

My wish is not delete a record, but to make impossible the view of a row.

 

This is the code of my controller: 

public with sharing class e2cprovasearchcontroller2 {

	public List<E2C_Email__c> emailsmod;
	
	
	public List<E2C_Email__c> getEmailsmod (){

	String id='500T0000004QpWr';

	this.emailsmod=[Select id,subject__c,FromName__c,Read__c,CreatedDate,CcAddress__c from E2C_Email__c where Case__c=:id ORDER BY CreatedDate DESC];

	return this.emailsmod;

	}


}

 

 

This is the code of my page : 

	<script
		src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" />
<script src="https://ajax.microsoft.com/ajax/jquery.ui/1.8.5/jquery-ui.js"/>
<link rel="stylesheet" type="text/css" media="screen" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/base/jquery-ui.css" />	
	
<script type="text/javascript"> 
	
	//modifico il selettore in modo da non avere conflitti con jquery.
	
 $j = jQuery.noConflict();
 	 
        
 function hiderows(){
 
 var prova= $j('#subject'+ 'a0TT0000003BMmGMAW').parent();
 
 var prova2=$j('#subject'+ 'a0TT0000003BMmGMAW').closest("tr");
 
 
prova2.remove();

 
 }       
        
</script>


	<apex:form >

		<apex:outputpanel >

			<apex:commandbutton value="prova" onclick="hiderows()" />

		</apex:outputpanel>



	</apex:form>
	<apex:outputpanel layout="block" style="overflow:auto;height:200px">
		<apex:pageBlock id="pb" mode="maindetail">
			<apex:pageBlockTable value="{!Emailsmod}" var="e" columns="5"
				cellspacing="5" onRowClick="show(this)">

				<apex:column headerValue="From" width="22%">
					<span id="from{!e.id}"> {!e.FromName__c} </span>
				</apex:column>
				<apex:column headerValue="Subject">
					<span id="subject{!e.id}"> {!e.Subject__c} </span>
				</apex:column>
				<apex:column headerValue="Date" width="7%">
					<span id="date{!e.id}"> <apex:outputText value="{0,date,dd/MM/yy hh:mm}">
						<apex:param value="{!e.CreatedDate}" />
					</apex:outputText> </span>
				</apex:column>

			</apex:pageBlockTable>
		</apex:pageBlock>


	</apex:outputpanel>

 

 

Thanks to all,

 

F.P.

Hello,

 

I am new to VF pages and I'm getting an error but I don't know what it means.  My error when I try to save the VF page is:

 

Error: Could not resolve the entity from <apex:inputField> value binding '{!test.Input_1__c}'. <apex:inputField> can only be used with SObject fields.

 

Below is my VF page and Controller:

 

VF:

 

<apex:page standardController="Account" tabStyle="Account" extensions="TestController3">
   <apex:form >
   <apex:pageBlock >
       <apex:pageBlockSection columns="2">
            <apex:inputField value="{!test.Input_1__c}"/>
            <apex:inputField value="{!test.Input_2__c}"/>
       </apex:pageBlockSection>
        <apex:pageBlockButtons >
            <apex:commandButton value="Save" action="{!Save}"/>
        </apex:pageBlockButtons>
       </apex:pageBlock>
    </apex:form>
</apex:page>

 

 

Controller:

 

public class TestController3{

public List<Test_Object__c> test {get; set;}
    private final Account acct;
    public TestController3(ApexPages.StandardController myController) {
        acct=(Account)myController.getrecord();
        test= new List<Test_Object__c>();
        Test_Object__c test2 = new Test_Object__c();
        test2.Company_Name_Test__c = acct.id;
        test.add(test2);}


    public PageReference save() {
        insert test;
        PageReference home = new PageReference('/home/home.jsp');
        home.setRedirect(true);
        return home;

}

}

 

Can someone help?  Thanks,

 

John

 

  
  • August 02, 2012
  • Like
  • 0

I'm creating a DataTable but I will be feeding it data from a created object in my controller but I will not be using the SELECT SQL command.  What kind of object do I have to create in my controller to work with the DataTable?  I'm assuming it's going to be a List, but a list of what?  A list of class objects with just variables?

 

Thanks.

 

P.S.  I'm quite new to Visualforce ... hence this question.

Hi,

 

We have an application we have built on our platform for managing our training business.  We use one object to produce a certificate for delegates after the course.  The certificate displays a signature and sometimes a logo dependant on the course.  We store these images in "Documents" which we make externally avaiblable and use the <apex:image> componenet to display.  This was working fine up until today.  Today for some reason none of the images will display in the pdfs.  I cannot see any changes to the code or the links we have been using - was there any changes made to the Salesforce platform last night which could effect this?  Has anyone else seen this issue?

 

The line of code we use is:

 

<apex:image height="1.3cm" url="https://eu1.salesforce.com/servlet/servlet.ImageServer?id=015D0000001Fs3o&oid=00D200000000Evl" />

 

https://eu1.salesforce.com/servlet/servlet.ImageServer?id=015D0000001Fs3o&oid=00D200000000Evl

 

I would approach support but I've be told in the past that with our service level they do not support VF.

 

Many Thanks.

Julie

 

  • July 26, 2012
  • Like
  • 0

Hello All,

 

Good Morning, I'm getting below mentioned error while creating a VF page.

 

"System.QueryException: Didn't understand relationship 'accobj' in field path. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.

Error is in expression '{!search}' in component <apex:page> in page inlineopportunitysearch


Class.OpportunitySearchController.search: line 38, column 1"

 

 

VF Page-

 

<apex:page standardController="Account" extensions="OpportunitySearchController" >
<style type="text/css">
        body {background: #F3F3EC; padding-top: 15px}
</style>
<apex:form >
<apex:pageBlock title="Search For Opportunities With Keyword" id="block" mode="edit">
<apex:messages />
<apex:pageBlockSection >
<apex:pageBlockSectionItem >
<apex:outputLabel for="searchText">Keyword</apex:outputLabel>
<apex:panelGroup >
<apex:inputText id="searchText" value="{!searchText}"/>
<apex:commandButton value="Search" action="{!search}" status="status" reRender="resultsBlock"/>
</apex:panelGroup>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:actionStatus id="status" startText="Searching ..Please wait"/>
<apex:pageBlockSection id="resultsBlock" columns="1">
<apex:pageBlockTable value="{!searchResults}" var="srs" rendered="{!NOT(ISNULL(searchResults))}">
<apex:column headerValue="Name">
<apex:outputLink value="/{!srs.Id}">{!srs.Name}</apex:outputLink>
</apex:column>
<apex:column value="{!srs.StageName}"/>
<apex:column value="{!srs.Amount}"/>
<apex:column value="{!srs.CloseDate}"/>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

 

Contrller ===>

 

public class OpportunitySearchController
{
    private ApexPages.StandardController controller {get; set;}
    private Account accobj;
    public List<opportunity> searchResults {get;set;}
    public String searchText {
    get
    {
       if (searchText == null) searchText = 'Acme';
       return searchText;
    
    }
    set;
    }
   
    
    public OpportunitySearchController(ApexPages.StandardController controller)
    {
      this.controller=controller;
      this.accobj=(Account)controller.getRecord();
      
         
    }
    
    //fired when the search button is clicked
    public PageReference search()
    {
          if(searchResults==null)
          {
             searchResults = new List<opportunity>();
          }
          else
          {
           searchResults.clear();  
          }
          
          String qry = 'Select o.Id, o.Name, o.StageName, o.CloseDate, o.Amount from Opportunity o Where AccountId =\''+accobj.Id+'\' And accobj.Name LIKE \'%'+searchText+'%\' Order By o.Name';
          searchResults =Database.query(qry);
          return null;
    }

}

 

Please helpme to get it corrected. Thanks for you all help and suggestions.


We've been struggling with getting a zipped static resource to work for weeks now. We got Salesforce Support involved from the beginning, but they've gotten us nowhere. If we can't get a resolution to this issue soon, we might just find a platform that wastes less of our time...

 

Here is the situation - we are trying to upload a portion of the YUI library as a static resource, but no matter what we try, we can't get the files to render in our VisualForce pages. Salesforce Support can get it to work (sometimes), but we can't. The difference seems to be around the MIME Type that is set when the file is uploaded. When we upload the file, it gets set to a MIME Type of 'application/zip', but when SFDC Support uploads the file, it gets set to a MIME Type of 'application/x-zip-compressed' or 'application/octet-stream'. Salesforce can't explain to us exactly why or how these different MIME Types get set. They're looking into why our uploads don't work, but I'm not expecting much from them at this point.

 

To reproduce our steps:

 

Download the file from here after clicking the radio button labeled "Full developer kit":

Steps:
  1. Download "Full developer kit"
  2. Open zip and remov the documentation and examples folders (to reduce size)
  3. Change file name from "yui_3.0.0.zip" to "yui.zip"
  4. Upload as a static resource named "testyui"
  5. In component "header" (where all other JS files are included) add:
    • <apex:includeScript value="{!URLFOR($Resource.testyui, 'yui/build/yui/yui-min.js')}" />
  6. If we refresh the page we get a 404 error for this resource.
 
If anyone has experienced a similar issue, any help you could provide would be greatly appreciated.