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

learn more… | top users | synonyms

0
votes
1answer
15 views

Visualforce page sharing same extension instance

From here I understand that it is possible to add multiple pages to a single extension but I want to take it further and not generate a new extension instance when the other page is loaded but keep ...
-1
votes
2answers
23 views

Issue with Extension Code Coverage

I have an Extension that works perfectly but the Test Class only has 65% code coverage. I cannot figure out why I don't have 100% (or at least 75%). Any help is greatly appreciated! Extension Class ...
8
votes
0answers
54 views

How to write the superduper (=proper and stable) Custom Save method

Custom Save actions in Apex are tricky! Here are my requirements which I was unable to fulfill without harming the stability of my code: Save for New and Edit (works with record with and without ...
1
vote
3answers
19 views

Visual force + Extension = Can't display values?

Working on a PDF report using Visualforce. Earlier questions answered here (LINK) but now I'm stuck again. I have two child objects off of Account. Issue (Issue__c) Filing (Filing__c) The ...
0
votes
1answer
31 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 ...
1
vote
0answers
23 views

Attachment Parentid population

I have two VF Pages. Say V1 , V2 where V1 is my parent page and V2 is included in it. Here in V1 an instance of a custom object (Call) is created and in DML insert it gets into the system. In V2 ...
0
votes
1answer
37 views

Create new records using Visualforce action and AggregateResult

I have a need to aggregate values from child records, group them by an Id field on that record and then create a new record for each corresponding ID. I have 2 objects, Sesaco_Contract__c and ...
0
votes
2answers
36 views

Passing a Visualforce InputField to a Controller Extension

Sorry for the newbie question ... I'm just starting out and I have a simple issue that I'm hoping someone will be able to help me with. I'm not able to pass a value from an inputField on a VF page to ...
1
vote
2answers
35 views

Which custom save() is better?

Sometimes in code examples of custom save methods (of controller extensions) you see the use of try/catch and an explicit translation of Exception to PageMessage. Explicit Error Handling: public ...
1
vote
3answers
35 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 ...
0
votes
0answers
46 views

Testing controller extensions with a feildset for by custom object

From past few days i'm working on writing an Apex test for my controller extension. I've created a dummy record for my custom object then passing the id in the constructor while invoking my extension. ...
3
votes
1answer
68 views

How to instantiate a class in custom controller from within controller extension?

This should be simple. I have a custom controller like so public class MyClass { . . . public class MyType{ String a; Integer b; List<Account> c; } ...
3
votes
0answers
50 views

How to test controller extension for 'New' record use case?

I'm trying to create a test class for a null record. I have a vf page, and extension, that acts as a form for creating a new record. In my extension constructor I have the following code public ...
0
votes
1answer
31 views

Trying to make Apex Test Class for VF page extension class but keep getting errors

Trying to save this Apex Test Class keep getting error Error: Compile Error: Constructor not defined: [GoogleMap_Meeting_Controller].() at line 35 column 51 Here is the VF page extension: ...
1
vote
3answers
50 views

Test Class Issue - My REST Method Isn't Getting Run

In my visualforce page I have a search field (inputText) with an id of 'query'. Query is passed into my controller and the runSearch() method starts a process which initiates a web service call. In my ...
0
votes
0answers
17 views

Overwriting Save&New button on edit page with controller extension

I need to extend the functionality of my save&new button by passing the current recordType of the record to be saved to the new record. Am I able to do this somehow with a controller extension, or ...
1
vote
0answers
17 views

Accessing Case.ContactId from Case StandardController (for Controller Extension) on [New]

I'm building Custom Console Component pages to display with Case detail in Service Console to display other recent cases, assets, related Contact/Account details, etc. leveraging the Case.Id that is ...
0
votes
1answer
33 views

Is it possible to call a PageReference method from inside the controller (w/o user interaction)?

I'm wondering if it's possible to call a PageReference method in a controller without the user having to click on any vf page buttons. For example, I have the following condition...(see below)...and I ...
0
votes
2answers
105 views

Pass inputField value to controller before a record is created/ saved

I'm trying to get the value of an apex:inputField on my vf page before the a record is saved/inserted. Here's my scenario. The user is presented with a blank form (all input fields on the vf page ...
0
votes
1answer
40 views

Referring to a controller extension in VF remoting

I’ve created a class to extend a standard page controller… (documentation) <apex:page standardController="location__C" extensions="locationExtension"> The class locationExtension contains… ...
0
votes
0answers
29 views

Custom button extension: field update on click

I am trying to create two buttons that inserts Up and Down on a record by clicking a command button. Here is my code so far: VF Page: <apex:form id="votingSection"> ...
-1
votes
1answer
47 views

Assign Value to record from button click

I have two buttons: <apex:form > <apex:commandButton styleclass="btn-lg btn-data" value="Vote Up" action="saveUP"/> <apex:commandButton styleclass="btn-lg btn-data" value="Vote Down" ...
1
vote
1answer
146 views

Display default picklist value as Read-only on Custom Object

I am fairly new to Salesforce and recently came across an interesting problem for which I have been trying to find a solution. My app has a Custom Object called MyCustomObject__c with a VF named ...
0
votes
2answers
30 views

Dialogue alerts within a pageReference

I am working on a Visualforce button that calls an action in the extension. <apex:commandButton id="submitButton" value="Submit" action="{!submit}" onclick="return confirm('Are you sure you want ...
1
vote
1answer
53 views

Empty values in a picklist

Root-cause: From the controller alone, it adds empty values but it can be removed with javascript though the javascript doesn't work. VF PAGE <apex:column rendered="{!allowDiscount}" ...
1
vote
1answer
43 views

Test Class Guidance (What, not How)

I have the following extension class that I'm using to build a visual force page. It is intended to display a filtered list of Campaign History, rather than the existing related list. It works. ...
1
vote
3answers
124 views

Detail of Page A Repeating on VF Page w/ Custom Object A Sibling Object Records B on Visualforce Page

I have a custom object "Success__c" that I am attempting to create a visualforce page for. I would like to have the parent (MD relationship via account__c) Account fields on the page, as well as the ...
0
votes
0answers
90 views

Autopopulate fields on custom object from opportunity

We have a custom object which has a field called Proposal_Number__c , which us also a custom field in opportunity. So when user enter values in Proposal# we want to auto populate other fields in ...
2
votes
2answers
191 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 ...
1
vote
0answers
130 views

field validation on approve or reject for approval process

I am creating an Approval Process. Its a simple process with 2 approval steps I have a requirement where an assigned approver (user) must populate one or more fields on a record before they approve or ...
3
votes
1answer
69 views

StandardController delete() method problem

Does somebody know what can cause the problem that StandardController delete() method doesn't delete the custom object from the context. My extension for Standard Controller has such method: public ...
1
vote
1answer
64 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 ...
2
votes
1answer
131 views

Test Class for Visualforce page

I have a visual page controller with save() function. Inside the save() function, there is an insert object. However, when I write my test class, I am unable to query the inserted object. ...
0
votes
1answer
110 views

Why isn't this dynamic VisualForce page style toggling the Static Resources properly?

I'm currently looking at the Dynamic References to Static Resources Using Mostly, it works as expected, with one anomaly: When the page initially displays, as expected, it correctly uses both the ...
0
votes
2answers
379 views

How can I write a unit test which includes ApexPages.StandardController methods?

Currently looking at the Using Dynamic References with Custom Objects and Packages tutorial. For reasons I won't speculate on, step 7 included the controller extension code (again) instead of the ...
3
votes
1answer
108 views

How can I test create an instance of a VisualForce Controller Extension for testing?

Typical of custom controller extensions, my extension has a signature public MyVFCtrlExt (ApexPages.StandardController standardController) I'm currently trying to figure out how to write unit tests ...
0
votes
1answer
50 views

How to mass update parent from child list view

I need help with a controller extension to retrieve and update parent records from a list view. We have a child object called Patient_Session__c that has a lookup to parent called Patient_c and want ...
0
votes
1answer
89 views

can we use single controller in two VF pages?

Here is a scenario where i have a search page for users to select and display the search results. I also have a button to generate the pdf. I have a list of account in the controller which displays ...
3
votes
2answers
94 views

How do I prevent the creation of multiple Records with an overwritten save button?

I have a custom save method, which saves my object and redirects me to his parent. This works fine for me and I used this kind of approach very often. Visualforce Page: <apex:commandButton ...
1
vote
1answer
198 views

Test class for VF form can't refer to input: 'variable does not exist'

I am very new to the model-view-controller and have barely been able to get my code functional, but now I'm struggling even more trying to write test code! This is my first wrapper class, controller ...
3
votes
0answers
66 views

Internal Server Error in Partner communities when using extension controller

We have a appexchange app in which there is a global class. We are using this global class as controller in local VF page and also created a extension class. When i try to use the variable declared ...
1
vote
0answers
48 views

Unable to create an instance of extension {CLASS NAME}

I'm getting this error, i'm sure I what this means. I couldn't find anything helpful anywhere.
1
vote
1answer
91 views

Checking if object exists on controller

I'm trying to handle the edge case where a user hits my page without the Id being set for whatever reason. However, I'm having problems detecting when no object is loaded. I tried this: private ...
0
votes
1answer
57 views

Writing a Test Class for an Extension

How would I write a test class for this extension? public class PictureofSuccess{ public Account ac {get;set;} public List <Picture_of_Success__c> pictures {get;set;} public Boolean noImage ...
1
vote
2answers
1k 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 ...
1
vote
2answers
47 views

Expression cannot be assigned at line

How could I assign a value to a dynamic query field? I want to make an update of a record. ac.get(campo) = totalAcumulado.get((String)ac.Name); <-- Expression cannot be assigned at line This ...
1
vote
2answers
607 views

Conditional parameter to change visualforce page and controller SQL

I have a very simple visualforce page and linking controller that will fetch records from a custom object. In this custom object there is a category field which I would like to filter against in the ...
1
vote
2answers
493 views

Error in VisualForce Page as :List index out of bounds: 0

Can any one help me out with this Error ??Any help is much appreciated Error in VisualForce Page as :List index out of bounds: 0 Here is my VF Page and the Class. Visual Force Page : ...
0
votes
1answer
167 views

Display message on parent window after closing VF Popup

At the moment I have a button placed on my Opportunities page which opens a popup, on my sendRequest() function this popup is closed. What I would like to do is further improve this function to also ...
2
votes
1answer
1k views

Get current logged in users data in VF page and extension

I want to display the currently logged in users in my VF page. Calling the following is not allowed: <apex:outputField label="Raised by" value="{!$User.Id}"/> I would like to know how else I ...