Questions tagged [wrapper-class]
Used for organizing data to be 'Wrapped'. Typically allows for better manipulation or sorting of data.
472
questions
9
votes
1
answer
5k
views
Using a generic SObject in VisualForce Page
I have a wrapper class that I want to reuse for Both Accounts and Contacts
public class SelectableSObject{
public Boolean selected {get; set;}
public SObject obj {get; set;}
}
In the ...
7
votes
1
answer
10k
views
How do you access a wrapper class from a Test class?
I have a VisualForce page which uses a controller. Within the controller I have a couple of wrapper classes which hold various form elements on the page. Everything works great, but now it is time ...
6
votes
1
answer
2k
views
Display the related aggregated value on a VF page
We have a custom VF page that we use in our Org for time entry, and on that page employees select a project, iteration, and enter their time for that week. Note: some employees might be working on ...
5
votes
1
answer
2k
views
Boolean value not setting in wrapper class
I am having an issue with a wrapper class I have created to set a boolean value from a checkbox on a table located on a visualforce page. I have based my work off a widely cited example here: https://...
5
votes
3
answers
7k
views
Wrapper class, controller and visualforce
I have a visualforce page where I am showing all the attachments related to a case with a checkbox to know if the user has marked it. This is the related part of the VF page:
<apex:pageBlock title=...
4
votes
3
answers
1k
views
Adding a Wrapper Class to an External Class
I am confused about what is happening in a small section of some code. I have a class that has a wrapper class inside it. There is an external class that calls this wrapper class Models.add(new ...
4
votes
1
answer
2k
views
Sort List of SObject in Wrapper Class
I have Wrapper class which contains List of Map.
After performing some operations that List values order gets changed.
public class TeacherAvailabilityWrapper{
public List<Session__c> ...
4
votes
1
answer
2k
views
How to insert 3rd level nested records using rest class?
I am trying to insert Account/Contact/Customer records into SFDC using Rest API. i have written the following class. I am able to create the Accounts and Contacts, but I'm having issues creating ...
4
votes
1
answer
987
views
Invalid field error for wrapper class list variable
Force.com save problem:
Save error: Invalid field ver for SObject Verifier__c
Follwing is my code
Apex Class Code
public with sharing class verifierclass{ public string applicationId {get;set;}
...
4
votes
1
answer
1k
views
Can you sort a soql query based on number of child records you have
I have a soql query
private static String selectQuery = 'select name,uw_Brand__r.Banner_Location__c,Inherit_Branding__c,Sharing__c,ownerid,Banner_1_Location__c,Description__c,LastModifiedById,...
4
votes
1
answer
6k
views
Select only One row of table by using radio button [duplicate]
I want to select only One row of table using apex:selectRadio.. please share some code or helping link if any.. Thank You..
when i click or check one radio button other should be unchecked according ...
4
votes
3
answers
1k
views
Clone sObject field values from Wrapper class
I have created one wrapper class with sObject and index for sObject and im getting and setting list of wrapper to show on VF page.
On VF page im showing some fields from that sObject and provided one ...
3
votes
2
answers
3k
views
How to sort Wrapper class?
Am working with Aggregation on an object and i have specified count field in Order By Clause.
Am loading aggregate results into wrapper class. Here am not getting the values in specified order.
In ...
3
votes
2
answers
432
views
Sorting of two different records referencing their dates
I just want to ask if comparing of each fields on separate object is possible in order to show first the most recent.
Example, I have Object A and Object B, and Object A has Hired_Date__c , and ...
3
votes
1
answer
2k
views
How to serialize a string into a Blob value without backslashes?
I have a Map<string, String> that is populated using the following code below. When I attempt to convert this into a serialized string so that it can be passed into Blob.valueOf, the \" (...
3
votes
1
answer
377
views
Wrapper class sorting where sort is not lexicographical
I've seen a couple of questions regarding sorting a Wrapper class, but I don't believe any meet my requirements. (Please correct me if I'm wrong) So I've implemented sorting for my wrapper class, and ...
3
votes
1
answer
2k
views
Custom sObject sorting with 'implements comparable'
I'm trying to perform a sort on a list of custom sObjects using the 'implements comparable' wrapper method. I'm running into some error that it seems isn't affecting anyone else. My custom object ...
3
votes
1
answer
2k
views
Is it possible to write a method that accepts both SObjects and Apex Class Instances?
I have an Apex method that takes a list of SObjects, a source field name, and a destination fieldname. For each SObject in the list, it looks at the source field, does some work, and populates the ...
3
votes
2
answers
6k
views
Getting error : Nested object for polymorphic foreign key must have an attributes field before any other fields
My mock body looks like :
'{"totalSize": 1, "done":true,
"nextRecordsUrl":"WWW.testurl.com","records":[{"Name":"Fund1", "...
3
votes
1
answer
1k
views
Is it possible to cast wrapper instance dynamically?
I wonder if it is possible to cast object parameter passed from LWC Component to specific instance of Wrapper class. In Example we have WrapperB that extends WrapperA and we want to cast data passed ...
3
votes
1
answer
717
views
Implementing CompareTo In An Inner Class That Needs Outer Class Data
I'm using Apex and VisualForce to make an "open house event check-in page" for a department. For various reasons pertaining to AppExchange plugin compatibility, we are storing a separate "Event" ...
3
votes
1
answer
6k
views
JSON deserialize into wrapper class errors
I'm trying to set up integration to display quiz answers in a Visualforce page, but I'm having a lot of difficulty deserializing a JSON string (supplied via API call response) into a wrapper class ...
3
votes
2
answers
4k
views
Refreshing Page block table to show recent values from database
Issues faced in code:-
I have a list of Test Person in page block table coming from wrapper.
A detail button on each row shows the details in below section.
When i click on save Details the updated ...
3
votes
1
answer
80
views
Salesforce Apex Access Nested Lists after Parsing JSON with Wrapper Class
I think I am just missing something simple - using very simplified and generic code for example.
I have some JSON:
{
"level1":[
{
"level2":{
"id&...
3
votes
1
answer
3k
views
How can I use a reserved keyword as an identifier in my JSON wrapper class
From salesforce Trying to Create PayPal payment, In Create Payment method request object has Items with Currency like below
"name": "hat",
"description": &...
3
votes
1
answer
2k
views
How do I correctly cast List in wrapper class?
I am receiving the following error in my Apex runtime:
JSONException: Expected List<ApexBatch.SFError> but found {
It's do with how I'm assigning the response to my wrapper but I'm not sure ...
3
votes
1
answer
60
views
Maintaining state across dynamically generated pageBlockTables
It's been a while, and I feel like I'm missing something simple/obvious but have been spinning my wheels for a while and can't find an answer.
The essence of my problem is that I cannot maintain the ...
3
votes
3
answers
430
views
Do big classes reduce performance?
I have a big (right now it's 1,4k lines) 'toolbox' class. I have a lot of static methods and wrappers there which are used in various number of services or manager/handler classes.
Does anyone notice ...
3
votes
1
answer
1k
views
Visualforce Dynamic Binding Map of wrapper Object
today i need your help for an issue I'm facing.
I have the following custom controller
public with sharing myCustomController {
public Map<String, wrapperObj> myMap {
get {
// ...
3
votes
2
answers
3k
views
Wrapper class Fetching all the Values
By using search function i need to fetch parent record and child record, the search function is happening in child record. Search function is fine But it is showing all child records in parent.
this ...
3
votes
1
answer
6k
views
To display two fields from two different objects in a single column of a table?
The requirement is to pull the CommentBody field from CaseComments and TextBody field from EmailMessages and display them in a single column in a table. The other column should contain the created ...
3
votes
1
answer
4k
views
Select a row using checkbox wrapper class
I have a pageblock with 2 columns and a checkbox column in Apex:repeat. Im trying to select the whole by selecting the checkbox. when I select the checkbox, the value is not being captured. Yes im ...
3
votes
1
answer
115
views
Can we use proxy from sencha component without wrapper class (request and response) in its corresponding controller class?
I have build an application that has Sencha on VisualForce page. It has a proxy to get salesforce data. I have used Wrapper classes (Request and Response) in my controller class for answering Sencha ...
3
votes
2
answers
2k
views
Adding Radio Button In wrapper class
I am trying to do something same to Contact Role in Opportunity related list. For this i need to add a radio button on this, i have a wrapper class which is used to display on VF page how can i get it ...
3
votes
1
answer
470
views
Set a inner wrapper value bound to an inputfield during "onchange" event
I currently have a complex but structured object for my visualforce page. The object itself has multiple wrapper objects within itself, currently about 3-4 deep. For example:
public class ...
3
votes
1
answer
1k
views
Upsert using wrapper class? Products not getting selected after checking the checkbox
I have written the following code to upsert the selected records using Wrapper classes. But I am getting Null Pointer exception . I am not understanding what I have missed. Please suggest. How can I ...
3
votes
2
answers
834
views
list exception out of bound
I am getting error as List index out of bound when i try to delete the record from pageblock table.
Sometimes the record gets deleted but sometimes it doesnt. It doesnt perform same everytime.
...
3
votes
1
answer
334
views
Pagination using wrapper Visualforce
I have this piece of code that works pretty fine, for "next" and "previous" buttons - however, despite my efforts, I have not been able to write effective code for "first" and "last" button. Please ...
3
votes
0
answers
298
views
how to create wrapper class so i can show two list data in csv
Header title show proper but its data not showing in proper format because two repeat i have applied, i want work only with one repeat
this is my class
public with sharing class ...
3
votes
2
answers
1k
views
List on Wrapper class not visible in lightning component
I have an Aura component and I want to iterate through a wrapper class of objects, which has two lists as properties. While I can iterate through the wrapper class list, my lists come up as null when ...
2
votes
3
answers
1k
views
SOQL Query Limits in Wrapper Class (using dlrs)
I have been trying to build a wrapper class which creates a junction Object (Delivery_Note_Line_Items__c) between two other objects (orderLine & Delivery_Note__c) depending on the Visualforce's ...
2
votes
2
answers
770
views
Need to write a Wrapper Class
This is my first wrapper class and I think it is a hard one. I tried to put this all into one query and it failed because of a junction object. I then put it into 2 queries using components and it ...
2
votes
2
answers
1k
views
How to set inner class list as aura attribute? [closed]
I am in need of showing a list of records in a summarized format, say all records belonging to Type 1 are displayed first, followed by the records of Type 2, and so on.
Usually in visualforce page, ...
2
votes
1
answer
646
views
Uknown property error in vf page while accessing wrapper class object
Controller Class --> wrapperClassController
public class wrapperClassController
{
public wrapperClassController(ApexPages.StandardController controller){}
public List<wrapperContact> con;
...
2
votes
1
answer
2k
views
Access the List<String> in wrapper class to LWC
I have a wrapper class in my apex controller.
global without sharing class Homepage_Ctrl {
public static List<variableDTO> dtoList = new List<variableDTO>();
public static ...
2
votes
2
answers
1k
views
Where/How can I store a variable and access while I build my wrapper? It's either null in wrapper itself or the scope isn't visible at top level
I have a set of ids called oppIdsInWrapper inner class. However while I build my wrapper, this is always null and empty. I want be able to reference this as I build my records to avoid duplicate ids. ...
2
votes
2
answers
2k
views
creating a matrix out of a flat table in visualforce
I have a controller which filters for variables: Sales Rep, Month, Revenue. However, in the VF page, I want to show this table as a matrix which would have Sales Reps in rows, Months in column and ...
2
votes
1
answer
3k
views
CompareTo - Sort order by date in Wrapper class
I have recently had help creating a Wrapper class to combine 2 separate objects, Delivery_Note__c and Remittance_Advice__c, into one list, both with their own date fields. The list is then rendered on ...
2
votes
1
answer
10k
views
How to send List<Wrapper class> from Lightning component to Apex Controller?
My question is bit similar to this. But I'm getting a Runtime exception in SF.
Not getting a compiler error, but in Apex, it's throwing,
FATAL_ERROR System.UnexpectedException: Salesforce System ...
2
votes
1
answer
207
views
Render Two Lists From Dynamic SOSL?
I'm working on a search page that searches through all the fields in multiple objects and used those searched fields results in Visualforce page to show the search results and I'm stuck on how do you ...