Questions tagged [controller-extension]

A controller extension is an Apex class that extends the functionality of a standard or custom controller.

Filter by
Sorted by
Tagged with
20
votes
3answers
14k views

Multiple controller extensions communication

I have a Visualforce page with two controller extensions. Is there any way to get a reference to one of the extensions in the other one?
3
votes
2answers
24k views

How to Write Test Class for Standard Controller Along With Extensions

Hi Everyone I'm finding it difficult to write test class for this class Class public class SendEmailReceipt{ public Payment_Receipts__c Rec; public string em{get;set;} public id ...
2
votes
1answer
674 views

SObject row was retrieved via SOQL without querying the requested field: Opportunity.OwnerId

I have the following code: public with sharing class ExportCheckPageController { public boolean checkYes { get{if(checkYes == null) checkYes = false; return checkYes;} set;} ...
0
votes
2answers
2k views

Access a variable in VF page from Controller without using get set method

I have a visual force page as below: <apex:page standardController="Interview__c" extensions="SkillReviewExtension"> <apex:form > <apex:pageBlock title="Candidate Skill ...
3
votes
1answer
496 views

“Data not available” when using Database.rollback() in custom save action

In my custom edit page for LineItem__c records I have overriden the save button with my own implementation which does not only save the record itself but also change to child records. <apex:page ...
11
votes
2answers
1k views

Do I have to prevent Dirty Updates myself when overriding Save in a controller extension?

The standard behavior (tested on Opportunities) is that Salesforce seems to handle dirty updates / save conflicts as expected: User A opens Opportunity X User B opens Opportunity X User A modifies ...
13
votes
3answers
8k views

'Map key null not found in map' when using apex:pageBlockTable

I have a simple controller extension with has a method which returns a Map<String, Map<String, Boolean>. public class UserExtension { private final User theUser; public ...
16
votes
1answer
12k views

How to override Save method in standard controller extension?

I am wriiting a extension on Case object. There I want to write a save method with my own logic and want this save method should override the standard Save method. So my code goes like below: ...
2
votes
2answers
2k views

Creating Salesforce Person Accounts via Visualforce

I have recently activated and configured Person Accounts in our salesforce org. We will be using these within the service console and also integrating Postcode Anywhere for address lookups. To ...
1
vote
1answer
598 views

Is apex getter method runs only once regardless of how many times it is called on VF page?

I have a basic question. I have a big VF page with many sections which render/hide based on some flags. The flags are set in constructor of controller extension and are mostly depend on the logged-in ...
0
votes
2answers
3k views

Populate address field upon Contact lookup selection

I have about 2 weeks experience in Visualforce and Apex and I am having trouble with displaying an address field related to a contact object. I have a custom Order object called WIMS_Order_c. With a ...
0
votes
1answer
794 views

how to create contact detail page using controller [closed]

public with sharing class ContactDetailController { private ApexPages.StandardController standardController; public string conId{get;set;} public ContactDetailController(ApexPages....
4
votes
3answers
3k views

Showing visualforce pages to Communities users, but standard Salesforce pages to all other users, without writing a dozen controller extensions!

I'm building a Communities site with several custom objects that Communities users should access through Visualforce pages. All other Salesforce users should access these objects through the standard ...
3
votes
2answers
8k views

Visualforce Page Unknown Constructor Error

I have a Visualforce page that is referencing a controller extension, but I am getting an Unknown Constructor error, which appears to indicate that the controller doesn't exist (but it does). I have ...
2
votes
1answer
2k views

Help displaying aggregate results in footer of pageblock table

I am trying to create a Visualforce page to display a list of related records (lookup relationship) in a PageBlockTable. I would like to include a footer row that displays the sum of one of the ...
1
vote
1answer
4k views

Writing JSON using JSONGenerator with writeStringField()

I'm wondering why I can't use the method writeStringField() on the class variables below. I'm using the JSONGenerator class methods instead of hand-constructing the string. global class ...
7
votes
3answers
52k views

Using PageReference to redirect after new record insert

Continuing from my previous post. I want to redirect the user to a custom vf detail page when they create a new Service Order from my custom page order page (force_NewOrder). I have created a ...
6
votes
1answer
893 views

Can there be a Shared Extension across Multiple Overridden Visualforce Pages?

I would like to know if its possible to share a common extension class across multiple Visualforce Pages which use different standard Controllers. For Eg., I've VF_A Page which overrides default ...
6
votes
2answers
1k views

Test ControllerExt for Flow

I am trying to get coverage up for the following controller extension which I am using with Flow public class ClosedLoopMarketingFlowExtension { private final Contact cont; private ...
4
votes
1answer
3k views

Can you access parent object fields in a 'New' page override without using SOQL?

I have two objects, Parent__c and Child__c, Child__c has a lookup field to Parent__c calledParentId__c. I have overridden the New and Edit pages for Child__c using a Visualforce page with the ...
3
votes
1answer
5k views

Error message: SObject row was retrieved via SOQL without querying the requested field?

I receive the following error: SObject row was retrieved via SOQL without querying the requested field: Installation__c.Name Controller extension on custom object: public class ...
3
votes
1answer
6k views

How to call methods from multiple extensions in visual force page

i have created visualforce page with multiple extension. For ex: for controller one(cntrl1) i have created method(methd1) and for controller two (cntrlr2) i have created same method(methd1). Now on ...
3
votes
1answer
76 views

Can I send a user to a standard layout edit page at the end of a wizard?

I want to do something that's been asked about before, but I am going to give some more reasoning in case I'm missing a better solution. I am developing a package. As part of this package, there's a ...
2
votes
1answer
160 views

Controller extension on an archived task

So I have a VF page that is being used to override the Task View and Edit actions. <apex:page standardController="Task" docType="html-5.0" readOnly="true" extensions="myControllerExt"> &...
2
votes
1answer
1k views

StandardSetController.getRecords() is returning unrelated records

In an VisualForce page I am using a standardController on the Quote object. I also have an extension that has a constructor that takes in a standardSetController. The standardSetController.getRecords()...
2
votes
1answer
4k views

Decision to use Custom Controller rather than Controller Extension

I came up with one question which asks me to select two options. Question is: When would a developer use a custom controller instead of a controller extension? Options are: When Visualforce page ...
2
votes
3answers
12k views

How to bind visualforce page values to Apex controller code for use in business logic

I have been trying to do something that I thought was easy, but it is making me crazy. I can get values from the apex code to be shown on a Visualforce page, that is ok, {get; set;} will do it. Now, ...
1
vote
1answer
215 views

List has no rows for assignment to SObject - Controller Extension

I've spent several hours today trying to figure this out and running through several online resources here and SFDC forums to no avail. I keep getting the following error: List has no rows for ...
1
vote
3answers
152 views

Custom Save on New/Edit page - Is this valid code?

In my controller extension I have a custom save method that works for New and Edit scenarios also saves modified child records The below code works in all unit tests but starts to show strange ...
1
vote
2answers
4k views

Re-rendering section on picklist value change - picklist value is always null

On a Visualforce page, I have a picklist (apex:selectOption). When a user selects certain values, additional input fields have to appear. Otherwise, they should be hidden. There are a couple of ...
1
vote
1answer
65 views

How to create contact detail page using controller? [duplicate]

How to create contact detail page using controller? <apex:page standardController="Contact" extensions="ContactDetailController"> <apex:form > <apex:pageBlock mode="maindetail" title="...
1
vote
1answer
84 views

Visualforce save only changed objects [closed]

I have a visualforce page with a custom save method in which I'm saving multiple objects. I want to save only those objects which got modified. Currently I'm doing an upsert on all objects when save ...
1
vote
2answers
71 views

Look up id value to pass to controller on save of new record via standard controller

Can anyone help me with the test class for below controller. I am trying to get the values of the vf page on save of a new record. standard controller will be null at that point but i need to access ...
0
votes
1answer
51 views

Controller Extension help

First, I don't have anything to post as far as code, because nothing has worked even remotely so far. I've written several extensions that allow me to 'look down' to child data (for instance, all the ...
0
votes
1answer
272 views

Redirecting to new Record after inserting does not work

this is a follow-up question to: How to clone and selectively change fields on cloned object? Situation: I want to clone a custom object, update a few fields and insert the cloned object into the ...
0
votes
1answer
657 views

How to get a Javascript variable to the apex controller class

Below is a VF Page I have. I do get the alert message with the URL. I am unable to get theValue variable value in Apex controller. Am I missing something here? <apex:page standardController="...
-2
votes
1answer
313 views

Test Class for the RemoteAction with HttpsRequest

Controller: global class GetcontentCalloutClass { public GetcontentCalloutClass(ApexPages.StandardController controller) {} public static Map<String, String> respStrings; global static ...