I have a Visualforce page which displays a related list of child objects. The list, however, displays the "New" button, which I need to remove. Is this possible, or am I stuck with building a custom related-list-like table?  For example, this code  &lt;apex:page standardController="Account"&gt;     &lt;apex:relatedList list="Contacts"/&gt; &lt;/apex:page&gt;   will display the related list which will also display the "New Contact" button. My objects are custom, but the problem is equivalent. Can those buttons be affected either from Visualforce code or from an extension controller?  Let me add that I can't simply remove the New button from the layout, because I need the related list in different custom pages, sometimes with and sometimes without the New button.
120707
When you click on the Opportunities tab, (assuming you haven't modified standard salesforce layout), you see a "Recent Opportunities" list. At the top of the list, there is a "New" button.     Is there a way to hide the "New" button displayed on this page? I have tried disabling the button on the "Opportunity List View" Search Layout[Setup -> App Setup -> Opportunities -> Search Layouts], but it does not remove the button from this particular view.
97305
I have got a SharePoint 2010 website with a WebPart-page and a few WebParts on it.  One of the WebParts displays a list/a view of a list.  The views of that list have been updated due to business needs - but the view in the WebPart on the WebPart-page is not updated.    If I edit "Modify Shared Web Part" (the one with the list / list view),  the "Selected view" is set to "&lt;Current view&gt;".  My question is now: Which view of the list is the "&lt;Current view&gt;"? Is it any view of the list at all - or has the WebPart some kind of its own view to that list?
84879
I have a Visualforce page that is used in both Salesforce1 and the desktop. On that page is a button. That button should only display if the user is loading the page on the desktop. It should be hidden on Salesforce1. Any suggestions?  Essentially I am just looking for a way to detect if the Visualforce page is loaded in Salesforce1 or not. I can handle the logic of displaying the button, I just don't know if it is possible to tell if it is Salesforce1 or not.
103246
I can't seem to call the objects out on the database and onto a visualforce page using this set up:   public with sharing class HarborEventController {  private final Event__c event; public HarborEventController(ApexPages.StandardController controller) {     this.eventlist = (Event__c)controller.getRecord(); }   public Integer eventcount{get;set;} public HarborEventController (){    eventcount = [SELECT COUNT() FROM Event__c];     }   public list&lt;Event__c&gt; mainlist {get;set;}   public list&lt;Event__c&gt; displayevents(){     mainlist = new list&lt;Event__c&gt;();     String mainsoql = 'SELECT Id, Name__C, Message__c, Display_Date__c, FROM Event__c';      mainsoql += 'ORDER BY Display_date__c LIMIT :5';     mainlist = Database.query(mainsoql);     return mainlist; }   and the visualforce page :           &lt;apex:composition template="eh_base"&gt;           &lt;apex:define name="heros-content"&gt;             &lt;/apex:define&gt;       &lt;apex:define name="content"&gt;        &lt;section id="services-sec"&gt;          &lt;div class="container"&gt;             &lt;div class="row" style="padding-top: 60px;"&gt;       &lt;apex:outputPanel layout="block" rendered="{!AND(NOT(ISNULL(mainlist)),mainlist.size&gt;0)}"&gt;         &lt;apex:form id="blockofeventtorepeat"&gt;             &lt;apex:repeat value="{!mainlist}" var="evententry" id="repeat"&gt;                 &lt;div class="col-md-9"&gt;                    &lt;h3&gt;&lt;apex:outputLink styleClass="evententry-header block" value="{!$Page.eh_eventdetails}?id={!evententry.id}"&gt;{!evententry.Name__c}&lt;/apex:outputLink&gt;&lt;/h3&gt;                     &lt;apex:outputPanel &gt;                      &lt;p&gt;                          &lt;img src="{!URLFOR($Action.Attachment.Download, evententry.Attachments[0].Id)}" class="pull-left img-responsive" alt="" style="max-width:180px;max-height:100px"/&gt;                         {!evententry.Message__c}                      &lt;/p&gt;                        &lt;apex:outputLink styleclass="btn btn-sm btn-default" value="{!$Page.eh_eventdetails}?id={!evententry.id}"&gt;Read More&lt;/apex:outputLink&gt;                      &lt;/apex:outputPanel&gt;                 &lt;/div&gt;                 &lt;/apex:repeat&gt;                 &lt;/apex:form&gt;                 &lt;/apex:outputPanel&gt;                   &lt;/div&gt;             &lt;/div&gt;                 &lt;/section&gt;           &lt;/apex:define&gt; &lt;/apex:composition&gt;     Can anyone suggest how I can able to get the event data from the query and display it on a visualforce page in a repeat tag? I've tried everything and it doesn't work.  I've already tried passing the query from an anonymous user and the results were as expected
116333
How can i remove or hide back button in the salesforce one UI. it take back me to the previous page but i don't want to give this functionality. So how can i hide or remove back button from custom VF pages and Standard detail pages.
20599
I am receiving apex errors with the following code:   public with sharing class AddExistingSpecsExt {      public Specifications__c loadedSpec { get; private set; }  public AddExistingSpecsExt() {     String specId = ApexPages.currentPage().getParameters().get('id');     if (String.isBlank(specId)) return;      List&lt;Specifications__c&gt; candidates = [         SELECT Id, Name, Product__c FROM Specifications__c WHERE Id = :specId LIMIT 1     ];     if (!candidates.isEmpty()) loadedSpec = candidates[0]; }     public PageReference associate () {          Specifications__c candidates = new Specifications__c ( Id = Specifications__c.Product__c, Name = Specifications__c.Id);          try {             Database.update(candidates);         } catch (Exception error) {             ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Error while associating.' + error.getMessage()));         }          PageReference page = new PageReference('/' + candidates);          return page.setRedirect(true);     }      public PageReference cancel () {         PageReference page = new PageReference('/' + Null);         return page.setRedirect(true);             }  }   Attempting to add records to a related list through a custom button and small vf page.   The Error is Line 16      Invalid initial expression type for field Specifications__c.Id, expecting: Id   Any help?
7733
I have a VisualForce page that is made up of different components. One of my components is passed in a Case and displays the case fields.   If there is an edit to the case I would like to save it with associated controller to that component. If saving produces an error I would like to pass that error to the parent VisualForce page/controller and display the error message there.   Is it possible to communicate with other components/VisualForce pages? I am looking for something similar to an event in lightning components.
119361
I have a vf page that is a custom button. That's it.  this VF page is on a STD Page Layout. When the user clicks on the VF page, the parent window needs to be redirected to the new URL.  The way this is working, is that the new page is opening in the vf section of the page layout.   &lt;apex:page standardController="Opportunity"  standardStylesheets="true" extensions="OpportunityController" &gt; &lt;base target="_parent" /&gt; &lt;body style="background:#f3f3ec" &gt; &lt;apex:form &gt; &lt;center&gt;  &lt;apex:commandButton action="{!redirect}"  value="Change Record Type" rendered="{!render}"/&gt; &lt;/center&gt;   &lt;/apex:form&gt;    &lt;/body&gt; &lt;/apex:page&gt;
74626
I'm trying to fetch the contact record and showing on page using  its showing error      Unknown property EditContact_controller.wrapperClass.conList   Which thing is unknown.  here is my controller  public class EditContact_controller{     public List&lt;wrapperClass&gt; wrapClassList{get;set;}     public List&lt;contact&gt; conList;     public wrapperClass wc{get;set;}      public EditContact_controller(){         wrapClassList = new List&lt;wrapperClass&gt;();         conList = new List&lt;Contact&gt;();         conList = [SELECT Id, FirstName, LastName FROM Contact LIMIT 10];         For(Contact co : conList){             wc = new wrapperClass();             wc.flag = false;             wc.conWrap = co;             wrapClassList.add(wc);         }     }     public class wrapperClass{         public boolean flag{get;set;}         public Contact conWrap{get;set;}       }     }   Here is my VFPage  &lt;apex:page controller="EditContact_controller" tabStyle="Contact"&gt; &lt;apex:form id="frm"&gt;     &lt;apex:pageBlock title="Contact Records"&gt;          &lt;apex:repeat value="{!wrapClassList}" var="contactTable" id="cont_Table"&gt;             &lt;table&gt;                 &lt;tr&gt;                     &lt;th&gt; Action &lt;/th&gt;                 &lt;/tr&gt;                  &lt;tr&gt;                     &lt;th&gt; First Name &lt;/th&gt;                 &lt;/tr&gt;                  &lt;tr&gt;                      &lt;th&gt; Last Name &lt;/th&gt;                 &lt;/tr&gt;                   &lt;tr&gt;                     &lt;td&gt; &lt;apex:inputCheckbox value="{!contactTable.flag}"/&gt; &lt;/td&gt;                 &lt;/tr&gt;                  &lt;tr&gt;                     &lt;td&gt; &lt;apex:outputField value="{!contactTable.conList.FirstName}"/&gt; &lt;/td&gt;                 &lt;/tr&gt;                  &lt;tr&gt;                     &lt;td&gt; &lt;apex:outputField value="{!contactTable.conList.LastName}"/&gt; &lt;/td&gt;                 &lt;/tr&gt;               &lt;/table&gt;                    &lt;/apex:repeat&gt;      &lt;/apex:pageBlock&gt;  &lt;/apex:form&gt;
46698
My project has a table with '+add' button and filtering. The add button opens a dialog to add item, and then to 'save' which closes it too Today I noticed the following flow:  Filter table on subject with value 'dummySubject'  Add new item with subject 'somethingelse'  save and close the new item ==&gt; the new item is shown in the table   So the outcome is that an item that does not qualify the filtering appears in the table. When I asked around I got the following answer  We don't want the new item to 'disappear' on creation just because it does not qualify the filtering. So we display it If you filter again, it will disappear as it should  I can almost understand that logic, but still it sounds wrong. I would rather have like a toaster saying 'new item create' with a 'goto' link. My question is  is the current user experience considered a reasonable one? what is the best practice way to handle such scenario?      &ndash; Wireframes created with
90982
Consider a simple example of a VF page that shows an account, with a pageBlockTable to display contacts on the account.  But if there are no contacts for the accounts, instead of an empty table we want to display a message.    VisualForce Page:  &lt;apex:page standardController="Account" extensions="AccountHelper"&gt;    &lt;apex:pageBlock title="Account"&gt;       &lt;apex:outputField value="{!account.name}"/&gt;   &lt;/apex:pageBlock&gt;   &lt;apex:pageBlock title="Related Contacts"&gt;       &lt;apex:pageBlockTable value="{!contacts}" var="ct" rendered="true"&gt;           &lt;apex:column value="{!ct.name}"/&gt;           &lt;apex:column value="{!ct.phone}"/&gt;       &lt;/apex:pageBlockTable&gt;       &lt;apex:pageMessage summary="Account has no contacts" severity="info" rendered="true" /&gt;   &lt;/apex:pageBlock&gt; &lt;/apex:page&gt;   AccountHelper.cls:  public with sharing class AccountHelper {     private Account account;      public AccountHelper(ApexPages.StandardController controller) {         account = (Account)controller.getRecord();     }      public List&lt;Contact&gt;getContacts() {         return [select id, name, phone from Contact where accountid=:account.id];     } }   Note that both the 'pageBlockTable' and the 'pageMessage' in the above example include rendered='true'.  What we want of course is a test of the contacts list from the controller, like this:  &lt;!-- doesn't work, this is apex, not a formula as required --&gt; &lt;apex:pageBlockTable ... rendered="contacts.size()&gt;0"&gt;   I can't find a formula to test the list size.  Is there a simple way to test this in the VF page?  One approach is to move the test to the controller, for example:  public with sharing class AccountHelper {     private Account account;      public List&lt;Contact&gt; contacts {         get {             if (contacts==null) {                 contacts = [select id, name, phone from Contact where accountid=:account.id];             }             return contacts;         }         set;     }      public AccountHelper(ApexPages.StandardController controller) {         account = (Account)controller.getRecord();     }      public boolean getHasContacts() {         return contacts.size() &gt; 0;     }  }   The VF page is then updated to match, e.g., rendered="{!hasContacts}.  However, the list of contacts is now being cached.  In a more complex example with action methods that update the database and rerender parts of the page dynamically, changes to the account's contacts in the database will not be picked up, unless we ensure each such action method also set contacts to null to ensure a fresh query.  Not onerous, but our controller extension keeps adding code for what should have been a simple in-page test.  But let's take the example one step further.  Let's say that we want alter the display (add an icon, or change the background color) of each contact based on whether or not the contact has any cases in the system.  The query in the controller can get cases:  contacts = [select id, name, phone, (select casenumber from cases) from Contact where accountid=:account.id];   But how can the VF Page test the cases subquery to alter the display?  The only approach I know of is to create an inner wrapper class for contact, and have the Contacts getter return a List of wrapper objects; the wrapper class can the have the logic to check cases.  This will work, but again, the controller is growing in complexity for what is basically a simple test - does a list have members?
15708
I'm trying to display opportunities associated with an OpportunityLineItem on a Visualforce page on the OpportunityLineItem object   I have a problem in the select I do not know how to retrieve the OpportunityLineItem name in this request I have hard code the OpportunityLineItem name  public List&lt;OpportunityLineItem&gt; getOpp() {     return [SELECT TotalPrice, Opportunity.Name, Opportunity.StageName,                     Opportunity.Account.Name, Opportunity.id, Product2.Name              FROM OpportunityLineItem               WHERE Product2.Name='GenWatt Diesel 10kW'     ]; }
108304
Is there any way to override 'New' standard button with lightning component and refer the parent record as prepopulated value in record creation screen?  I saw in some posts to achieve this using visualforce override and pass parent recordid in url but I wanted to achieve using only lightning component.  Please let me know if more details are needed.    As shown in screenshot I have to override this standard 'New' action to open a form and prepoulated opportunity and account information and few fields of Agreement record itself.
10397
I have created custom button called "New Employee" on employee object and it is related with both account and contact objects via lookup relation. If i click on "New Employee" button on employee related list under Account detail page, working fine in both salesforce classic and lightning experience but not in partner portal.  /a03/e?CF00N342300009cAB8={!Account.Name}&amp;CF00N342300009cAB8_lkid={!Account.Id}&amp;CF00N90000009cUVB={!Contact.Name}&amp;CF00N90000009cUVB_lkid={!Contact.Id}&amp;retURL={!Account.Id}   Any help on this.
68431
Can any one explain the usage of controller and extensions in Visualforce? In which scenario we have to use controller and extensions?
87723
I have 5 columns in the custom list. Out of which only 3 have to displayed in the NewForm.aspx page.  All of the 5 columns have to be displayed on the EditForm.aspx page. While googling, I have come across the following  :  When I implemented the code that was given on this page, I get an error which says that parentNode is not found. Please guide me how can I implement this requirement.  Any other alternatives other than this are also appreciated.
89335
I'm diving into visualforce and the standard controller for the first time and having trouble iterating over a single opportunity's related records. The below code produces an error:  &lt;apex:page standardController="Opportunity"&gt; &lt;apex:pageBlock title="{!Opportunity.name}"&gt;     &lt;apex:pageBlockSection title="{!Opportunity.Id}"&gt;         &lt;apex:repeat value="{!Opportunity.Custom_object__c}" var="c"&gt;             &lt;apex:pageBlockSectionItem&gt;                 {!c.Name}             &lt;/apex:pageBlockSectionItem&gt;         &lt;/apex:repeat&gt;     &lt;/apex:pageBlockSection&gt; &lt;/apex:pageBlock&gt;&lt;/apex:page&gt;   The error I'm receiving is as follows:  Error: Unknown property 'String.Name'   I take from this that the Visualforce is not interpreting the {!c.Name} as the array of objects I thought it was but instead as a string. I am able to save the file when I remove {!c.Name} which makes me think that  is correct but, on the other hand, when substituting value="{!Opportunity.Account}" the code correctly retrieves the related Account. My instinct is that I'm not referencing the related child-objects correctly. I've been banging my head for a bit of time and was wondering if someone could provide some insight as to what is going on?