Questions tagged [controller]

A controller is one piece in the Model-View-Controller (MVC) architecture of Visualforce. A controller can be a standard or custom controller and extensions to controllers can written.

Filter by
Sorted by
Tagged with
0
votes
2answers
21 views

How to simulate visualforce page button in test class in order to deploy it?

Hi I have an Apex class which is called/invoked from a custom button called "desiredLocationsPage" , I have created the custom button in production like below; I have tested my test class in sandbox ...
0
votes
1answer
25 views

Lightning Component redirecting to record it is creating

I am trying to create a new record using a save button on a lightning:recordEditForm Im am fairly new to coding lightning components and have come to a bit of a standstill trying to get it to ...
3
votes
1answer
54 views

Redirect to VF Page not firing

Good day, I posted this over on the Salesforce Dev community forums but have gotten no responses. I'm hoping someone here might be able to assist. We have a call center application integrated with ...
0
votes
1answer
24 views

How to assign field values to a constructor in Apex Test Class?

I am trying to test my custom controller's saveNewContact() method. I am trying to set the fields on the page, or in the constructor contact, and attempt to save the record. Unfortunately, when I run ...
0
votes
2answers
31 views

<apex:inputSecret> auto populate is not working?

I want to display password value as secret and it need to be auto populate from salesforce without passing manually. I can able to display username but password field display empty. Anyone help ...
0
votes
1answer
68 views

userinfo.getuserid() returning null in test class

I have a test class which inserts partner user for testing. So, when I pass userinfor.getuserID(), it is returning null due to which my test class is failing with error "System....
0
votes
0answers
14 views

update partner account status field when partner user profile is updated

I have a partner user who has active partner account. If there is any issue with the payment, the users profile will be updated to "restricted profile". I have a requirement where, if a partner user'...
1
vote
1answer
34 views

4 Level Picklist Dependency

I'm trying to set up 4 picklist that are dependent on each other. The idea is this: There are 4 different picklist. Pick1, Pick2, Pick3, Pick4 Pick2 is dependent on Pick1. Pick3 isn't necessarily ...
0
votes
1answer
14 views

Save vf page as attachment in custom object

I have a dynamic virtual page that I create, and I would like to know if it was possible to save it as html (not pdf as I need to do some modification later on) inside my related files for a custom ...
0
votes
1answer
33 views

Writing test class for wrapper class to simulate the business process

I am trying to write a test class for a Wrapper class. The wrapper class pulls one objects to make it as a checkbox list. Could anyone help me to adjust the code I wrote below? I have written test ...
-1
votes
0answers
11 views

Visualforce Controller Test Class [duplicate]

I have the following method in my custom controller. I'm only able to get 68% coverage in testing. In the following method I'm not getting coverage for the permission set list I'm using. This is also ...
0
votes
0answers
22 views

Field Sets displayed by VF Components in VF Page: How can changes to the fields be saved from the page?

I have a Lightning component for saving an application. So far the first tab embeds a VF page. That page in turn includes a certain VF component twice. Finally, the component dynamically pulls in a ...
2
votes
1answer
154 views

ForEach “=>” Javascript lightning

I want to add an if condition before I can fill the map "mapDataCible". Is that possible? inp.forEach(input => mapDataCible[input.get('v.name')] = input.get('v.value'));
0
votes
1answer
34 views

issue with userdata in test class for auto registration handler class

I have a test class which is as below @isTest private class KC_Reg_Handler_Test { static testMethod void testCreateAndUpdateUser() { KC_RegHandler handler = new KC_RegHandler (); ...
0
votes
2answers
35 views

Visualforce page to compare two old record with newly cloned record and highlight changed values

I need to create a visual force page to compare an old record with a newly cloned record. For example: Existing Fields. Account (Old Record) Account (new Record) id ...
0
votes
0answers
20 views

Perform insert operation from selected checkbox to another object

Hi I hava visualforge and the controller to show list from another object as checkbox, and its working as expected, but I get stuck on the following; Perform insert operation, so from the selected ...
0
votes
1answer
29 views

Pass selected checkboxes to controller and perform insert operation

I have a Visualforce page with a page block section which contains multiple rows from different object (Result from query in controller from custom object called "Location__c"). I need to pass the id'...
0
votes
1answer
33 views

Available Lightning Controller Data Types

Where can I find a list of the acceptable datatypes for the lightning controller component.set() for list values? I can see that type: 'text' and type: 'date' and type: 'boolean' work but integer and ...
-4
votes
2answers
45 views

Filter Id value is not valid for the Object standard controller

Now it works :) Thank you guys! public class VFController { public VFController(ApexPages.StandardSetController setCon){} public ApexPages.StandardSetController setCon { get { ...
0
votes
0answers
13 views

How to copy js object from one variable to another

I have a problem in javascript controller while assigning response. I have response "response.getReturnValue()" from setCallback function which is a list of records. I want to assign this to 2 ...
3
votes
0answers
34 views

Case standard list controller won't show any records on visualforce page

I am new to Visualforce, and for the life of me I can't get a case standard list controller to show cases. It works for Accounts and Contacts, just not cases. Here is the code: <apex:page ...
-1
votes
1answer
22 views

Need help in writing Test Class for Rest API Class [duplicate]

I have a REST API class which updates the user status in external system when the user status is changed in Salesforce. Below is the code public class AccUpdateController { @future(callout=true) ...
0
votes
1answer
23 views

how to navigate to object detail page from lightning:card title

I have a list of projects displayed using lightning:card. I would like the user to click on the title and then navigate to the record detail page. I referred to some posts online but couldn't make it ...
0
votes
0answers
20 views

Visualforce Controllers: pass parameters from Custom Controller to Standard Controller

Could anyone provide me with guidance on how I can pass field parameters from Custom Controller to Standard Controller without the use of URL? Custom Controller - handles input parameters and ...
0
votes
1answer
28 views

How to get the public key in form of JWS Key set

I have a JWT Class which generates JWT Token using Private key. Now, I need to expose an endpoint for exernal application to get the public key in the form of JWKS KeySet. Can anyone guide me how to ...
1
vote
1answer
28 views

Future class error - First error: Argument cannot be null

I have a requirement where I need to send JWT token as a part of my request body. I have created a JWT class and an Apex rest class to acheive the required scenario. Below are the classes Apex Rest ...
1
vote
1answer
38 views

Wrapper in return method for test class

I'm creating a visualforce page for a Dashboard component. In the controller I have a wrapper class and in one of the methods I return a map of a list of the wrapper records. Example trimmed down: ...
1
vote
0answers
8 views

action failed:c: newasset_component$controller$doLibloaded['lightningUtilsLib' is undefined]

I have a strange error when i try to search for client in the global search. error action failed:c: newasset_component$controller$doLibloaded['lightningUtilsLib' is undefined] Some help? Thank you
0
votes
0answers
48 views

ERROR_CREATING_USER: Id not specified in an update call

We have a shop portal where the Account will be created in Salesforce whenever a user shops in that portal. When the user logs in for the first time to our community, partner user should be created ...
0
votes
1answer
29 views

Issues with insert/creating a record in custom object using custom controller

VF Page <apex:page standardController="Applications__c" lightningStylesheets="true"> <apex:sectionHeader title="Application For Employment"/> <apex:form > <apex:pageBlock >...
2
votes
1answer
26 views

Javascript Controller to Apex Controller naming syntax error

I am getting an odd bug where capitalizing the first letter of an Apex method that returns a map, causes an error within the javascript controller. Javascript: var action = component.get("c....
0
votes
1answer
23 views

How to get recordtypeid from generic object

I want to be able to pass an object, and recordtypelabel as string into a controller and get the recordtypeId. How do I achieve this. I currently get variable does not exist for the custom object. @...
-1
votes
1answer
48 views

Test for SOQL in Apex Controller

I'm not sure if I'm testing correctly. What check here should be done? Could you help with the test? public class Controller { public List<MyTool__c> tools {get;set;} public Controller(...
0
votes
0answers
23 views

How to fix callout error — You have uncommitted work pending. Please commit or rollback before calling out? [duplicate]

I'm doing an upload attachment to AWS, but I'm getting this error -- 'You have uncommitted work pending. Please commit or rollback before calling out' How do I fix this? @AuraEnabled public ...
0
votes
3answers
40 views

How can I get test coverage for a Visualforce controller?

with this test class I have a coverage of 0% someone has an idea why it does not work I can not recover the id of the product it seems that it is not inserted public with sharing class ...
0
votes
1answer
33 views

Can't update a field in a custom controller

I've been trying to get a selected value from a radio button (apex:selectradio, i'm styling it with the 5-stars like Uber) in a Visualforce Page and save it to a field called Quality_Content__c from a ...
0
votes
1answer
34 views

How to pass a variable from the controller into the extension

I have a variable (SelectedProfiles) that returns a list of profiles that are selected from a multi-select picklist on a VF page, and is used in the where clause in a SOQL query that returns the CRUD ...
1
vote
0answers
21 views

Full Handlebars Markup Language in Lightning email templates?

Is it possible to use full Handlebars Markup Language (like Handlebars helpers, #each, #lookup, and callbacks to controllers) in Lightning email templates? I want to create an email template for use ...
0
votes
0answers
18 views

Getting Null values in Controller variable from VF Components

I have a VF component which is passing some values to the controller but when I have put the debug statement then Null value is printed I think controller is being called first before setting the ...
1
vote
2answers
21 views

Why can't I apply replaceAll in my controller function?

I have the following component class, whose function is solely to modify a string for an email template. It works fine, inserting the concatenated string into the email. public class ...
0
votes
1answer
29 views

Google reCAPTCHA on Visualforce - server side verification

We have the Google reCAPTCHA all set up and working (in other uses in our org), but I'm having trouble getting it to work on my VF page. Clicking the submit button fires the recaptcha and I get a ...
0
votes
1answer
46 views

with sharing without sharing vs extension?

While going through manuals, it was mentioned Many times that apex classes will not consider security of logged in user but it will run in system mode and we should add custom controller extension to ...
0
votes
1answer
41 views

ignore empty values (or null) while passing JSON request to third party

I am passing request in JSON format to third party system but they want only to pass field which is not null else skip that field. I am trying to build logic to skip Null/Blank. Can someone please ...
0
votes
1answer
34 views

Test pagereference with selection of multiple Ids

I have a visualforce page where I select multiple ids. Based on my selection I start a flow. I dont know how to simulate the selection in my testclass. Visualforce <apex:page standardController="...
0
votes
1answer
27 views

String variable takes null value randomly after the first execution

In the first execution checkNumber takes the value from visualforce page properly.But after that sometimes checkNumber takes null value and shows the 'Please enter at least one search criteria' error ...
0
votes
1answer
17 views

VFP List Button Object Fields

Currently, converting a Javascript List Button to a List Button that uses a VisualForce Page. The button is on a related list on the Opportunity layout. Is it possible to grab Opportunity fields if ...
0
votes
1answer
36 views

Getting null in control from input field

I'm stack. I Have a simple controller and visualforce page. Controller: public class NewTaskSchedulerController { public Event Event {get; set;} public NewTaskSchedulerController(){ ...
0
votes
1answer
28 views

campinglistformcontroller.js can't insert form in database trailhead

I'm stuck at the last component Aura challenge, I managed the challenge but when I try to insert a form in the database it makes me mistakes. I tested with two submitform function ...
0
votes
1answer
51 views

Updating an array in controller to store user input from Visualforce page

I need to store input from user in controller so it can be used for calculations. To do this I am using an array, to get input in the controller. But getting issue: Subscript is invalid because list ...
0
votes
1answer
62 views

I have added a vf page(displays an error message) in pagelayout. I don't want it to be displayed when the case has attachment

I have a vf page that displays an error message. On Case object when I edit a case, and save it with an attachment, I don't want it to display that vf page. VF Page Code: <apex:page ...