Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

Questions tagged [getter]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2
votes
1answer
18 views

template if:true with get variable is not working

I have a custom part of code that I want to be displayed based on a custom logic cmp: <template if:true={myvar}> <!-- custom code --> </template> js: @track data; get myvar(...
1
vote
1answer
26 views

Custom component setter value being passed in to controller, but getter always returns null (or the initialized value)

The setup: I have a standard controller with two extensions on it. <apex:page standardController="Contact" showQuickActionVfHeader="false" extensions="ExtOne,ExtTwo"> <c:...
0
votes
0answers
39 views

Accessing variable from void method based on given argument

I need to take variable from my void method based on the given argument when calling the method in another class. template = //here I want to take variable "ExpiringContract" Below is the code; ...
2
votes
1answer
93 views

LWC Conditional rendering: alternative for fetching the initial database value?

Looking for a conditional rendering solution in lwc, which uses the initial value of a field in the database to decide whether to render or not. I have found a way to get it working, but it seems like ...
1
vote
1answer
369 views

LWC / Get fields values with getRecord and wire

I can't get fields values with getRecord adapter. Component shows passed recordId only. Where is the problem? Parent HTML: <template> <lightning-card title="My Trips"> ...
0
votes
0answers
15 views

Visualforce component custom getter breaking page commandLinks

I've seen this a few times and want to understand how to handle it. If I have a visualforce component with a custom getter (which I need to run initialize code for that component) embedded in a vf ...
0
votes
2answers
42 views

Problem with understanding way of work with VF page

So my task is to get two dates from user and based on that do some fancy logic which will result in creation of table with data requested. To begin with i wanted to create small VFpage with two ...
1
vote
2answers
95 views

How to access Class members decorated using { get; set; }

I'm trying to save on boilerplate code so tried to use { get; set; } idiom, but the function will not resolve. This is the class with decorated properties. public class Counter { private static ...
2
votes
2answers
22 views

Difference between using and not using get; set; in data passed from backend

What is the difference between using and not using get; set; in data passed from backend? I saw examples like this in Apex: using get; set; public with sharing class MyBackendController { ...
1
vote
1answer
94 views

JQuery and Disabled Attributes

I am unable to get this bit of JS to work. I have a few questions: Am I not allowed to put the disabled attribute on the apex:inputField? Am I importing the JS url incorrectly? Is it possible that ...
2
votes
1answer
475 views

Need help to cover {get; set;} methods on a TestClass

i need some help on a TestClass as i said above, bellow i wil show you what the class looks like and the TestClass: APEX CLASS: public with sharing class DirectDebitController { public class ...
1
vote
0answers
115 views

Overloaded Getter Methods for Apex Property

I've a little confused by the order of execution in the following very useful class from Adrian Larson. If I call "get" with just an SObjectType, invoking the first method, the cache.containsKey(key) ...
1
vote
2answers
200 views

setting RecordType in Test Coverage

I am having trouble on a test that is setting a record type. I believe I am setting the record type the correct way, the test is passing, but my test coverage is telling me that no record type was set....
1
vote
2answers
103 views

Visualforce getters are called before setter when selecting a select option

I've noticed that when I have an <apex:selectList/> with a value attribute that calls a setter method to set a value in the controller all my getters get called before the initial set call ...
1
vote
2answers
57 views

Setter value not arriving in apex class

I have a list that contains a collection of wrapper class instances called tacList. The wrapper class effectively contains a checkbox which relates to a case field and a string. The string is not ...
0
votes
0answers
325 views

Getter and setter methods for wrapper class in salesforce

Please help me in clearing this doubt.. I have a wrapper class which I am using to store JSON values received from external system, on doing Json.deserialize it parses all the values as received. ...
0
votes
0answers
42 views

Why can't we use set(setter) without a get(getter)? [duplicate]

I need to just display the result of the user input field in following code: public class EX_1 { public Integer i1{set;} public Integer i2{set;} public Integer result=i1+i2; public Integer display(){ ...
-4
votes
1answer
312 views

Why is the setter method not working in the following code?

On running the following code in apex and visualforce respectively i am receiving following error: Error: Unknown property 'Setter_Method.Oportunities' Quick Fix Create Apex property '...
4
votes
1answer
469 views

Overriding Getters and Setters from Base Class

I'm trying to convert an old global class to be a virtual class so I can have some variations on its implementation. There is some existing behavior on the property Getters that I'd like to preserve ...
-6
votes
1answer
517 views

How to assign value for getter setter variable from Apex test class [closed]

Class A{ public object obj{get;set;} } Test Class Class A_Test{ //how to assign value fo obj variable }
0
votes
1answer
456 views

How to get related object fields without the id in a query

I am working through a class that runs on before insert on the OpportunityLineItem object. Basically, I create a key on the OLI record, search for an existing custom object (Responsible Party) ...
4
votes
1answer
696 views

get set method for value in class

I have a class with a getter and setter method. Could anyone explain how this works. If I am correct it is suppose to get and set a variable between a visualforce page and apex class. Is this also ...
1
vote
2answers
83 views

Public Variable Returns Null

I am trying to return a JSON string to my controller for rendering on a Visualforce page. The query builds correctly and the JSON string builds locally within the method buildQuery. However my top ...
1
vote
2answers
335 views

Pull multiple fields from an object in get;set;

I have the following code linked to a vf page for a basic custom related list. I've figured out that it is not working due to not pulling the mr.Sample_ID__cbecause the get;set; at the top only pulls ...
6
votes
2answers
919 views

Need help understanding get/set methods, weird behavior

I came across this question somewhere which has been kept me engaged thinking why it is behaving this way. Lets say I have an apex class: public class TestController { public String myString{...
1
vote
1answer
157 views

Need clarification on a getter

I have a custom visualforce page and controller extension that is working. There is one getter that I do not understand why it works. I was hoping someone could explain it to me. In the below code I ...
0
votes
1answer
96 views

Getter Setter between two Visualforce pages

I am confused how to use to getter setter in the situation of two Visualforce pages having different extensions. 1 VF Page(Main Page): This page calls Opportunity as Standard Controller and having ...
10
votes
4answers
14k views

why we use {get; set;} syntax in wrapper class or in controller class

public class Wrapper { public String fname{get; set;} //why we use get; set; syntax here public String lname{get; set;} public String uname{get; set;} } also here public class Controller{ ...
3
votes
1answer
664 views

How to test a class that contains no methods

I have a class that only contains one map. public with sharing class testController { public Map<String, User[]> mapName {get {.....return value;} set;} } I am unable to instantiate the ...
0
votes
1answer
31 views

Turn public list to set with returning unique values

I have below declaration for a public list which I need to make a set so that only unique values show up. If not Set atleast I need this list to return unique values. Can someone please help me? Apex ...
0
votes
2answers
114 views

Null Pointer exception for a set<ID>

I have below code in apex constructor of the controller where it shows null pointer exception. Can someone please let me know if I have issues with declaration and also the workaround. for(...
0
votes
1answer
45 views

Problem with Rendered attribute behaving incorrectly. Seems to always return false when the page is loaded?

I must be doing something silly with my code, but cannot for the life of me figure out why neither the Boolean userNeedsVerify nor the method checkForVerify() are rendering when they should be. I've ...
0
votes
1answer
722 views

How to cover a getter/setter list (populated via query) in a unit test?

TL ; DR : I'm unable to fill a getter/setter list (that is filled via SOQL query) during testing. When unit testing a controller class, a certain {get;set;} list is not getting populated (it is null)...
6
votes
1answer
4k views

Simple getter setter

How to pass value from user side or vf page side by using this type of getter setter is there any way to pass value using this type? Here is the Code public class simplegetset { public String ...
0
votes
1answer
43 views

Different way to write getter and setter

Hi i have code that shows an error "Error: simplegetset Compile Error: Variable is not visible: userinput at line 14 column 15".I just want to know is this not right way to define get and set here is ...
1
vote
1answer
482 views

Init field with setter and getter

I can write Integer var {get; set;} but can not Integer var {get; set;} = 0 or Integer var = 0 {get; set;} Is it impossible to init field with set-get at the same line?
4
votes
1answer
176 views

Visualforce Private vs Public Getter/Setter Syntax/Structure & Order of Execution

There are already many threads on the confusion with Visualforce's Lifecycle/Execution Order, as their should be because its pretty confusing the more complicated your applications becomes. With that ...