7
votes
Accepted
Uknown property error in vf page while accessing wrapper class object
In order for the VF page to access the wrapper class properties you need to define the getter and setters:
public class wrapperContact
{
public Contact cont {get;set;}
public Boolean selected {get;...
7
votes
Accepted
Sort List of SObject in Wrapper Class
The confusion is that your class is not really what is termed a wrapper in the Apex community as a wrapper usually decorates a single object instance not a collection. Best drop that suffix from your ...
7
votes
Does Wrapper Class serve one purpose only?
Looking at what Google has to say, Wrapper is an alternative name for both these patterns:
Decorator
Adapter
So the examples that focus on adding a checkbox might be better labelled as Decorator ...
7
votes
How to set inner class list as aura attribute?
If I read this right, you want to use an inner class on aura:attribute tag. You cannot (rather should not) use an inner class as an aura attribute, instead you need to handle it differently. If that's ...
7
votes
Accepted
LWC JavaScript way to copy List [List A, List B] Values to a single List
Yes. You can use concat:
var output = listA.concat(listB);
Or you can flatten it:
var output = [listA,listB].flat();
Arrays in JS are very robust. You should take time to study their many features ...
6
votes
Accepted
How to insert 3rd level nested records using rest class?
You can create ContactWrapper class which contains standard Contact as a field and list of customers.
apex:
@RestResource(urlMapping='/Order/*')
global with sharing class OrderWebServicesV2 {
...
6
votes
Accepted
Sorting of two different records referencing their dates
It is possible to write a Comparable wrapper class that can work with various SObject types and fields:
public class DateFieldComparable implements Comparable {
private SObject sob;
private ...
6
votes
Accepted
Adding a Wrapper Class to an External Class
Somewhere else in the local context, there is a variable declaration that's shadowing the class Models.
Example:
public class TestQ242685 {
public class InnerClass {
}
public static ...
6
votes
Accepted
Issue with passing class data from apex to javascript in LWC
The attributes in the custom class that you have created should have the AuraEnabled annotation set on them. Then those attributes will be accessible on the javascript side.
public class ...
6
votes
Accepted
Access the List<String> in wrapper class to LWC
Javascript is case SEnSiTivE. You have defined variable in apex as monthListBefore but in JS you are trying to access MonthListBefore, which does not exist.
So, Try
this.MonthList = data[0]....
5
votes
Accepted
Wrapper class sorting where sort is not lexicographical
You can declare a constant list of mappings to numbers based on these values, eg:
public class Wrapper implements Comparable{
public const colorMap Map<String,Integer> = new Map<String,...
5
votes
Accepted
Need to write a Wrapper Class
Unless you're caching the result from the first request to the get; member on the controller every single time the VF page references the { get; member, it'll fire the query contained in the getter ...
5
votes
Accepted
Render Two Lists From Dynamic SOSL?
You need separate tables for each list. Something along the lines of:
<apex:pageBlockTable value="{!mySearchWrapper.accounts}" var="account">
<!-- columns -->
</apex:pageBlockTable&...
5
votes
Accepted
Invalid conversion from runtime type Boolean to List<>
Your problem is this area here:
<apex:inputCheckbox value="{!wrapList}" onchange="enableDisable(this);"/>
(There's a few instances of this problem, so only one is illustrated here.)
You're ...
5
votes
Accepted
How to send List<Wrapper class> from Lightning component to Apex Controller?
Fixed using this approach.
In Java script Callback,
var actSave = component.get("c.saveDataDML");
actSave.setParams({
"listToSaveString": JSON.stringify(itemList)
});
...
5
votes
Accepted
Wrapper Class in a Map
Use in the repeat
caseInfo.CaseNumber
Since caseInfo is akin to the loop variable in a for loop and each instance would be a wrapper record
When using the repeats think of each one as a for loop. ...
5
votes
Does Wrapper Class serve one purpose only?
I believe not.
Wrapper class is a custom table in my belief. Though checkbox is a great example of it. But above it, I have been using Wrapper Classes beyond it's scope.
Suppose there is a Custom ...
5
votes
Accepted
Not able to cover wrapper class in test class
Question 1:
Your creating child class with parent class instance.trying doing this, Create child class instance with parent class Name.
Syntax: OuterClass.InnerClass innerObject = new OuterClass....
5
votes
SOQL Query Limits in Wrapper Class (using dlrs)
I guess you are confusing the standard practice with SOQL FOR Loop . SOQL For Loops are allowed, but standard practice is you do not write SOQL inside FOR loop. Like this:
For(Contact c: contacts){
...
5
votes
Accepted
CompareTo - Sort order by date in Wrapper class
Based on your updates, simply compare calculatedDate between the passed in value (which you named other) and the instance calling the method. I find the following pattern readable and easy to ...
5
votes
Adding a Wrapper Class to an External Class
You seem to have a name shadowing here.
This code is adding CheckItemClass objects in a List<CheckItemClass> which is most likely declared in your controller as:
List<CheckItemClass> ...
5
votes
Accepted
Custom Inline Editable Table in LWC
The detail parameter can contain complex data:
this.dispatchEvent(
new CustomEvent(
'update',
{ detail:
{
fieldName: this.fieldName,
value: this.value
}
}...
5
votes
Accepted
How to serialize a string into a Blob value without backslashes?
In the given scenario, serialization occurs twice in the last three lines, and it is a cause of an observed scenario.
A better way to approach this could be using of Map<String, Object> instead ...
5
votes
Accepted
Getting error : Nested object for polymorphic foreign key must have an attributes field before any other fields
The deserialization needs to know what concrete type to use and that is signalled by an attributes field:
"records":[{"attributes": {"type": "fund__c"}, "...
4
votes
Accepted
Can Wrapper Class Objects be used for Trigger Logic?
You need to either instantiate the class or make the method static:
CustomClass c = New CustomClass();
c.testMethod(line_items);
Or
public static void testMethod(List<InnerObject> items){
...
4
votes
Accepted
Writing Test class for Wrapper Class
You are calling it wrong:
Change
InlineCtrl.WrapperMethod testWrap=new InlineCtrl.WrapperMethod(o,selected=false,index=1,editble=false);
to
InlineCtrl.WrapperMethod testWrap=new InlineCtrl....
4
votes
Accepted
Entity is not API accessible Error
Here is the error:
valuesList = split.fSPE('(,)',0);
If you comment this out, the Entity is not API Accessible error goes away (other compiler errors are exposed). You probably wanted
valuesList = ...
4
votes
Accepted
JSON deserialize into wrapper class errors
Regarding the event_data issue: your JSON is inconsistent. In one case it's an object containing the user_agent string:
"event_data": {
"user_agent": "Mozilla/5.0 (Macintosh; Intel ...
4
votes
Need to write a Wrapper Class
In relation to what is causing the problem, there is the question of whether the getter is called every time it is referenced in the page or not. The documentation says:
It’s a best practice for ...
4
votes
Accepted
Implementing CompareTo In An Inner Class That Needs Outer Class Data
You can pass in a reference to the controller class in e.g. the constructor:
public class WEvent implements Comparable {
private ActivityListAttemptController controller;
public Event e {get; ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
wrapper-class × 467apex × 295
visualforce × 154
lightning-web-components × 46
json × 41
lightning-aura-components × 29
unit-test × 29
class × 29
controller × 21
soql × 18
map × 18
list × 18
javascript × 17
lightning × 16
rest-api × 15
code-coverage × 14
lightning-datatable × 13
pageblocktable × 13
comparable × 11
sort × 9
deserialize × 8
inputcheckboxes × 8
trigger × 7
repeat × 7
inner-class × 7