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
1
vote
0answers
28 views

First error: No content to map to Object due to end of input

Below is my batch class which gets data from external systeglobal class LogClass implements Database.Batchable<Integer>,Database.AllowsCallouts, Database.Stateful { global Iterable<Integer&...
1
vote
1answer
45 views

Issue with Test Class for REST API

I have an apex class which fetches and upserts data from external source to Salesforce. Below is the batch class: global class PolicyCalloutBatchClass implements Database.Batchable<Integer>,...
0
votes
0answers
38 views

Error: System.NullPointerException: Argument cannot be null

I have a requirement where the data from external system is fetched and upserted back in Salesforce. below is my apex class: public class RESTClass { @future(callout=true) public static ...
1
vote
1answer
26 views

Error: System.JSONException: No content to map to Object due to end of input

I have a requirement where the data from external system is fetched and upserted back in Salesforce. below is my apex class: public class RESTClass { @future(callout=true) public static ...
-1
votes
0answers
23 views

Products not getting added when record is created by uploading csv [closed]

I have one controller to upload csv files to create a po record but it's getting created but products in the csv are not adding in the PO. My code is as below, public class POLoadController { ...
1
vote
1answer
35 views

Upsert records after parsing JSON response

I have a requirement to upsert Policy records using JSON response obtained from external system. below is my apex code: HttpRequest req = new HttpRequest(); req.setMethod('GET'); req.setTimeout(...
1
vote
1answer
32 views

Force.com Site: Read access denied for Custom_Object__c, but works fine in sandbox

I have a basic visualforce page that uses the standard controller for an object (Custom_Object__c). The object is a detail record, with the master being another custom object (Parent_Object__c). The ...
0
votes
1answer
19 views

Conditional not rendering output section

I have a pageblockSection I want to render if a conditional evaluates to true. This is my VF code <apex:page standardController="Intake__c" extensions="IntakeExtension,...
0
votes
1answer
44 views

Create record from JSON response recieved from external system [closed]

I have a json response which I got from external system using its endpoint. Now I need to create account records in Salesforce using that response. Below is my Rest Callout code: String jsonbody = '{ ...
0
votes
1answer
25 views

Math.max returns NaN in case of null values

I am a new one in javascript and there is a case. I have a controller with many input values and I want to get the maximum value of them. I use var getMax = Math.max(field1__c,field2__c,field3__c,.....
0
votes
1answer
43 views

Parse comma separated String to List in LWC

I'm building an LWC to be used in Record Page and Community, a custom related records list component, that shows formula fields properly formatted (rich-text formatted), so it uses targetConfigs ...
1
vote
0answers
23 views

Pass value to apex controller using apex action support

Im trying to pass values to apex controller from vf page but values are not passing. could you guys please check where im going wrong. VF PAGE <apex:repeat value="{!am.names}" var="n&...
0
votes
1answer
60 views

reRender Page Block Sections Based on Selected Value of a selectList

I am creating a Visualforce page and I have a section where I want to add in a Select List with three values and based on the value that is selected I want it to display a specific Page Block Section ...
0
votes
1answer
17 views

How can I pass a parameter into a method inside an if statement within a visualforce page?

I have the following Controller and Visualforce(VF) page where I need to conditionally display a different value based on what is passed into a method. Question How can I pass a parameter into a ...
0
votes
0answers
23 views

Test Class for system.runas(user) not working for UserInfo.getUserId Coverage

Im stuck at 52% coverage of a vf controller that queries and displays timecards__c records of UserInfo.getUserId in a table. What is basically not getting covered is the if else statements after the ...
0
votes
1answer
24 views

Issue while looping through child records

I have a requirement to check for Role_Name__c on Account_Role__c object which is a child of Policy__c object. Now, if any child records have Original or Duplicate as value in Role_Name__c, a new ...
0
votes
2answers
35 views

doInit function in LWC

I'm trying to update the record using the recordId passed from aura quick action, then lwc component will update the record. However when I try the following: called the connectedCallback but the ...
0
votes
2answers
37 views

Issue with after update trigger

I have a trigger which creates new Cust_Alert_record when Policy__c record is updated. Below is my trigger: trigger AlertTextforContact on Policy__c (after update) { List<Cust_Alert__c> ...
1
vote
1answer
43 views

How can I add/remove the “checked” attribute via LWC controller data?

Brief context: I have a page with n number of rows using for:each={rows} for:item="row". Each row has its own checkbox. There is a filtering feature that (by rerendering the with a getter) ...
0
votes
1answer
33 views

Issue while parsing JSON in Test Class

Below is my test method: static testMethod void callbackdateTomorrow() { Date currentDate; CurrentDate = date.today(); System.RestContext.request = new RestRequest(); ...
0
votes
1answer
16 views

Show Apex Errors on Visualforce Page

I have a VF page with a custom controller that allows a user to enter multiple records for a custom object using a Type picklist field. I also have a trigger that populates those values to the parent ...
0
votes
1answer
26 views

Show Trigger Error on VF Page

I have a VF page and custom controller on a custom object related to the Contact object. There is also a trigger on the custom object that prevents duplicate entries. All works fine, however, when a ...
0
votes
1answer
47 views

Custom Controller Question

I have a simple Visualforce page with 3 fields that launches from a controller method related to another VF page. The page loads properly using the controller below, but I am trying to pre-populate ...
0
votes
1answer
48 views

Issue with file count on Custom object

I have an apex class which updates the files count on custom object called Declined_Policy__c. Below is my apex class: public with sharing class Policy_FileCountClass { public static void ...
1
vote
1answer
87 views

Test class - Apex Controller for LWC bundle that displays Flow pause component

The out of the box Lightning Component that shows Flow Interview Pauses can only be added to a Lightning Page type of HOME. Users need it on the record page. I found a solution in the Salesforce help ...
0
votes
1answer
26 views

Getting Error in visualforce page while preparing to display collection of account record names in picklistcontrol with the help of SelectOption

public class NewSectionOptions { public List<SelectOption> lstoptions {get; set;} // SelectOption is an apextype class to add elements to picklist control in vf page. public ...
0
votes
2answers
69 views

Check if current record value present in other records

I have a requirement, where account name and account number if do not match with any other records, a custom field called alert_text__c will be updated with some text. It is as follows: List<...
0
votes
1answer
53 views

Check if long text area field contains given string

I have a custom field called Account_from__c which is a text field. Now, I have a Long text field called Warning_Message__c which contains warning messages. The warning message will be like "...
0
votes
1answer
8 views

Remove selected text from text area field

I have a field called description which tracks all the changes made to "Add to Description" field. When the description field is blank and any new value is entered into Add to Description ...
0
votes
0answers
29 views

VisualForce page screenshot - ouput displaying as blank

I have a vf page with a custom iframe url. This page also has a button which on click captures the screenshot and mails it to the given email id. Below is my vf page and controller: VF Page: <apex:...
0
votes
1answer
57 views

reference multiple controllers on a single lightning component?

I am working on a lightning component in which I am building a form. I already have a controller defined for it. However, within this component I wish to implement a custom controller that extends the ...
1
vote
1answer
23 views

How to create lookup field on visualforce for person account using a cutom controllercustom controller

I Currently have a visualforce page where I want a user to be able to select a existing person account or create a new one. I am getting the error: Attribute value in apex:inputField must contain only ...
0
votes
2answers
54 views

checking field update on multiple child records

I have a requirement to check Terminated__c flag on multiple child records (lead_Custom__c) and if it is true, then update the Terminated__c flag on Parent record (contact). Below is the apex class: ...
0
votes
1answer
64 views

Unable to set dependent picklist field as mandatory in lightning component

I have a controlling picklist field called Interaction Result and dependent picklist called Interaction Reason which i am displaying in lightning component. Now, I want to set the child field as ...
0
votes
0answers
52 views

Dependent picklist field is not getting displayed in the lightning component

I have a requirement to display dependent picklist called Interaction_Reason__c when controlling field called Call_Result__c is selected. These fields are from Task object. I could able to display ...
0
votes
1answer
27 views

Null pointer exception while using Trigger.newMap.keySet() [duplicate]

I have a requirement to update contact field on MC Subscriber Activity when the contact email id matches with MC Subscriber Activities field. Below is my trigger: trigger MCActivityonContact on ...
0
votes
0answers
50 views

Perform a User Lockout via APEX Test Class?

Is there any way to perform a User lockout via an Apex Test Class? I have a self-service account Unlock feature in my community portal. I'm writing a test class for the Controller - but to ensure that ...
2
votes
2answers
30 views

Date problem in Apex

I am generating current date in the js controller class. And, in the helper class, When I call the Apex method I am sending the date to apex as parameters. Here's the code: //controller.js ...
0
votes
1answer
73 views

display child records with checkbox on lightning component

I have a requirement to select child records of selected record on a detail page. This Lightning component, will be used on Account record page and that Account record's related contact records will ...
0
votes
1answer
39 views

Assertion Failed error when namespace is changed in aura component

Similar to this Post, when i change the namespace in aura component from ui:inputText to lightning:input, I'm getting the following error: Assertion Failed!: Attribute not defined in the component : ...
0
votes
1answer
31 views

error while changing the ui namespace to lightning namespace

I have a requirement to change the namespaces from ui: to lightning: as ui namespaces are going to get depricated in May'21. While doing so, I'm getting the error from the following tag <aura:...
0
votes
1answer
31 views

07:40:24:023 FATAL_ERROR System.StringException: Invalid id: a610V0000015C5DQAU

public void updateattendeecb() { System.debug(enteredText1); Id myId = Id.valueOf(enteredText1); list_attendees1=[Select id,Send_Email_for_Certificate__c from EM_Attendee_vod__c where id= :...
0
votes
1answer
16 views

Call Controller Method without triggering required=“true” validations

hoping for some guidance on how i can accomplish something in VF. Basically i have 2 SelectLists side by side where the left one contains a list of all SFDC users in my instance and the right one ...
0
votes
1answer
31 views

Lightning JS not firing the error message

I have a requirement to merge custom leads. When two leads are selected to merge and if their Integrated_Lead__c (datatype - checkbox) is true, then an error message should be displayed on screen. ...
0
votes
1answer
32 views

<apex:input> value not being passed to controller

I am setting up value to apex:input using JS as below. document.getElementById('{!$Component.street_number}').value = val; document.getElementById('{!$Component.street_number}')....
0
votes
1answer
78 views

Im getting Nan error during subtraction of two times not two dates. can you please help me how to resolve it

var startDate = component.get("v.time"); var endDate = component.get("v.time1"); var days = (endDate-startDate)/8.64; alert(days); I'm getting error like ...
0
votes
1answer
31 views

Use invocable method on the MergeCaseController, error that i will not be able to use the invocable method on a constructor. thank you

I am trying to use the invocable method on Public MergeCaseController(ApexPages.StandardsetController controller) so that i can call this from a flow.. But i am having issues doing so, public ...
0
votes
1answer
143 views

How to display toast message on record opening

Below is the toast component that will be displayed on button click on record page Component: <aura:component implements="force:hasRecordId,force:appHostable,flexipage:availableForAllPageTypes&...
0
votes
0answers
10 views

How to pass data from child VF Component to Parent VF Component [duplicate]

I have two components, one component is a child of another component. I want to access value present in controller of child vf component in controller of parent vf component. Can anyone suggest how to ...
0
votes
0answers
28 views

Can someone tell a TEST for this [duplicate]

I have written this APEX class to use as a controller on a VFP. I need to write a TEST class for this. Can someone help with the test class for the below code ? Thank-you (The use case is to auto ...

1
2 3 4 5
26