Questions tagged [controller-extension]
A controller extension is an Apex class that extends the functionality of a standard or custom controller.
42
questions
21
votes
3
answers
16k
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?
17
votes
1
answer
14k
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:
...
3
votes
1
answer
534
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 ...
3
votes
2
answers
35k
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
1
answer
767
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
2
answers
3k
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 ...
13
votes
2
answers
20k
views
SObject row was retrieved via SOQL without querying the requested field in controller extension
I have written this controller extension:
public with sharing class PopupController {
ApexPages.Standardcontroller cont;
public Request_Change_Reseller__c req{get;set;}
public ...
13
votes
3
answers
10k
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 ...
11
votes
2
answers
2k
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 ...
2
votes
2
answers
3k
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
1
answer
1k
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
1
answer
823
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....
0
votes
2
answers
4k
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 ...
8
votes
2
answers
44k
views
How to set record type of records while saving the records?
I have a vf page and its extensions,I am trying to save the multiple lists of a object against a particular recordtype.But i am unable to fetch the record the record type and then assign to the same ...
7
votes
3
answers
66k
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
2
answers
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 ...
6
votes
1
answer
976
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 ...
5
votes
3
answers
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 ...
5
votes
2
answers
14k
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 ...
4
votes
1
answer
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 ...
4
votes
1
answer
597
views
Unknown property
Why am I getting the following error?
Unknown property
Controller Extension
public class CrewWorkDetailController{
public final Installation__c installation ;
public ...
3
votes
1
answer
6k
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
1
answer
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
1
answer
85
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
1
answer
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 ...
2
votes
1
answer
6k
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
1
answer
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
1
answer
189
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
3
answers
13k
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, ...
2
votes
1
answer
5k
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 ...
1
vote
2
answers
5k
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
1
answer
72
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
1
answer
106
views
No Save and Controller Extensions throw Unknown Property Errors
For clarity, and as I accepted an answer in the last question, I am posting a new question for additional help with new issues.
The last question can be reviewed here.
Here are my new issues:
When ...
1
vote
3
answers
162
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
1
answer
92
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
2
answers
101
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 ...
1
vote
1
answer
297
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 ...
0
votes
1
answer
416
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
2
answers
991
views
Unknown Property Error on VF Main Extension
UPDATE 12/29/2020:
For clarity, and as I accepted an answer here, I am posting a new question for additional help with new issues.
The new question can be reviewed here.
UPDATE:
I am trying to switch ...
0
votes
1
answer
1k
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="...
0
votes
1
answer
55
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 ...
-2
votes
1
answer
394
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 ...