Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [list]

A list is an ordered collection of elements that are distinguished by their indices. List elements can be of any data type—primitive types, collections, sObjects, user-defined types, and built-in Apex types.

-1
votes
0answers
23 views

Invocable Class To Return Multiple Objects Illegal Assignment Error

Missing the correct concept here and struggled too long. I am trying to optionally gather multiple multiselect inputs in a Flow, split them in Apex, and return multiple Sobject Collections. I ...
0
votes
1answer
17 views

Insert a List collection into a Map Collection with the same index

I am trying to add a List of collection to a Map Collection with the same Index. I have this Code: List<Account> accountContactList = [SELECT Id,Name FROM Account]; Map<Integer,List<...
0
votes
2answers
77 views

Many Lookup Relationship for One Object

I have the case of an object having two lookup relationship and I call for a list containing both relationship as follows. This is my Setup code public static List<Job_Application__c> ...
0
votes
1answer
22 views

How does joining two custom objects into one custom object through master-detail relationship work

I've been working on a test method but I've had a problem creating the setup of it. public static List<Job_Posting__c> createPostings(){ List<Job_Posting__c> testPostings = new ...
0
votes
1answer
25 views

Does Salesforce or any third party maintain a list of which formulas work in list views?

I am looking for a list of formulas that work in list views. For example, you can set "last login" = LAST QUARTER on the user list view, which is very helpful for generating a list of users who have ...
1
vote
1answer
33 views

List sorting by custom field

I dont know how to sort a list of SObject Case. I have a List<Case> newCases which i iterate over in for cycle, where i save Cases to my new List<Case> casesList. for (Case newCase : ...
0
votes
1answer
29 views

Add a new field with value to an already existing SObject

The goal is to get base64 of attachments of each record to render them in a visualforce page. Each record may have any number of attachments or no attachments at all. Map<Id, SObject> results =...
0
votes
1answer
24 views

Add a new List<object> to an already existing List<Object>

Is it possible to add a new list to each object in an already existing list? List<MyObj__c> results = [SELECT Id, Name, Text__c FROM MyObj__c]; I have a second object obj2__c. I want to add ...
-3
votes
2answers
31 views

How to separate only duplicated elements in apex List? [closed]

I have a List with objects and some of them are duplicated. I need a new list containing only the duplicated elements but each element must be available only once. For instance: {1, 1, 1, 1, 2, 2, 3,...
-1
votes
1answer
39 views

Chunk Account list into List<List<Account>>() based on a condition

I am having trouble with a small piece of code. I am calling an API, with List of accounts address. API is working fine, but it gives error when URL endpoint length exceeds 3500. I have a look on ...
0
votes
1answer
18 views

Combine two List<Map<String, String>> for unique list

How can I combine two lists of maps so that only the unique values in the list remain? I thought about doing some nested for loops to compare the two lists, but it seems a bit messy. Is there a ...
2
votes
1answer
62 views

Delete all records in All Subscribers List at once

We're doing some data cleanup here and need to delete all records from the All Subscribers List. I've seen several suggestions regarding exporting all the records from All Subscribers to a CSV, then ...
-2
votes
2answers
80 views

List size isnt working as expected for partner user

I have observed very weired nature in Lists result. I run this query in query editor: select id, Title, Description, FileType,FeaturedContentDate,FeaturedContentBoost,ContentDocumentId,TagCsv from ...
1
vote
2answers
53 views

Create List of Strings from Another List of Object Records

I am new to Salesforce development and I am trying to practice by creating a list of strings deriving from another list of object records created from a query. My code is the following.... public ...
0
votes
1answer
123 views

SOQL: Retrieve records based on List of Booleans

I have this json object coming in for boxes: Boxes: [ { count: 5, Fragile: true }, { count: 10, Fragile: false } ], I have box records that need to be updated based on if they are fragile or not ...
4
votes
1answer
57 views

Bound data binding does not work with list items

Let me start by showing you what I am doing. ParentAppWithListAttr.app <aura:application > <aura:attribute type="List" name="justAList" default="['hello','world']"/> <aura:...
1
vote
1answer
56 views

Error: Too many DML rows: 10001

I have a question here, every time I run my code I first delete everything that is in the object, and then inserted a new list, when I try to do this simultaneously with the error ERROR System....
0
votes
2answers
18 views

APEX: Can't add instances of a custom class as elements of a list within a complex class

When I try to initialize an instance of the daisychain class below, using the makeDaisyChain method, I get a "System.NullPointerException: Attempt to de-reference a null object" error. ...
0
votes
1answer
24 views

Data Duplication [closed]

I have a List in which I am adding registry, but I noticed that the registry comes duplicated, for that I used a set, but the set only returns me a single registry instead of a List, can someone help ...
-1
votes
2answers
55 views

How to Divide a list which has set of duplicate values in it in apex

for(AggregateResult hier4: hierarchy) { fld4.add((String)hier4.get(Field1)); fld5.add((String)hier4.get(Field2)); fld6.add((String)hier4.get(Field3)); string Soqlstr3=' Select Name '...
0
votes
1answer
35 views

APEX Would like to validate my approach [closed]

I have written the following REST callout to update Club & Players custom object. Based on the API ID club information is fetched and updated, same for players as well. For players I need to check ...
1
vote
1answer
29 views

Removing ALL Duplicates on a List

I'm facing a Requirement Specs that can be simplified to this scenario. Simply put, the specs say to remove all duplicates from a list. This means not to leave one duplicate record from the list but ...
0
votes
0answers
22 views

Add rows on button click without loosing input values from prev row

I'm trying to make a table with add row functionality. The process is next: User works with one row, put data in input fields, and then add another row. The first row must contain data that user ...
0
votes
2answers
36 views

how to add a List<List<String>> on a statement

Hello there I just want to put same 3 statement on a List> row List> [0] Statement 1 on a first row / List> [1] Statement 2 on a second row / List> [2] Statement 3 on a second row / To This same ...
1
vote
1answer
50 views

Is there a way a more efficient way to write the IF statement

Is the there a more efficient way to write the below IF statement so I only need 2 lines of code or can this be solved with a ternary operator ? if(postIds.size()>0) { PostProperty(...
-3
votes
1answer
25 views

How to compare list custom setting records with other list of lead?

How to compare list custom setting records with other list of lead? //this list store the list of lead records List<Lead> leaddetails=new List<Lead> leaddetails(); //This custom setting ...
0
votes
3answers
32 views

apex:param get just last element. How to fix that?

I create delete-button to remove records from my list. First I choose records and add them to this list. Then I can delete some records, but it removes just last one. How to delete only selected ...
0
votes
2answers
34 views

Add second element of map (multiple same ID)

I wanted to know how to get the second element of my oppTeamMemberWrapper map knowing that its ID exists in several times in the wrapper map (the ID being the ID of the parent opportunity)
0
votes
1answer
20 views

How to test catch-part of the method? [duplicate]

I tried to put null rows and do many another things. I can't test this catch. It writes System.QueryException: List has no rows for assignment to SObject. public List<MyObject__c> getList(){ ...
0
votes
2answers
28 views

Error Method does not exist or incorrect signature

Getting the following error at line number 7. Method does not exist or incorrect signature: void add(Auto_Risk_Fill__c) from the type Map List<Auto_Risk_Fill__c> autoValues = new List<...
0
votes
1answer
31 views

updating related list

List<Opportunity> op = [ SELECT Id,AccountId, External_Id__c, StageName, Sales_Office__c, Held_or_Purchased_Model_Lookup__c, Subdivision__c, Lot__c, Hold_Expiry_Date__c,...
0
votes
2answers
22 views

Apex output only showing id how to show all data in list?

I am trying to display data that is being return by an API. On my system.debug I can see the data is there but on displaying on the page it only shows an array of the ids of the list object. This is ...
0
votes
1answer
34 views

How to use a few conditions for the same SOQL values?

I have a few conditions for the same fields of record. But I get the result only from last condition. How can I use them all? public List<Item__c> serch(){ String[] filters = new String[0]; ...
0
votes
1answer
11 views

Record ID not returning from list

I recently posted a question regarding preventing a null list exception (Link), which was answered but doesn't seem to return a result. Using the suggested solution, I have updated my controller, ...
0
votes
1answer
28 views

Create new filtered mobile contact list with automation

I've currently got an import automation which imports files dropped in an SFTP location. It adds them to a mobile list I have called SMS_Master. It works fine. Our marketing team then has to filter ...
0
votes
2answers
112 views

Apex - break list into multiple small lists before processing

I have a list of 15,000 records. I can maintain the count in a flag. Integer Counter = 15000; I want to break my main list into 3 small lists. Each list should contain 5,000 records. First list ...
0
votes
1answer
17 views

Illegal assignment from List<or_guestsJSON> to or_guestsJSON

I an trying to write a testclass for a JSON object but het the error: Illegal assignment from List to or_guestsJSON. How do I annotate the list in my testclass? Class public class or_guestsJSON ...
1
vote
1answer
61 views

How to set the variables of invocable method in unit test

I have an invocable method with varables. I am stuck how to set these in unittest Class public class or_service { public class invoceVars{ @InvocableVariable public id ...
1
vote
1answer
77 views

How can we add a new action (like Edit & Delete) for each record on the standard list page (Salesforce Classic)

How can we add a new action (like Edit & Delete) for each record on the standard list page (Salesforce Classic)?
0
votes
1answer
28 views

Sum up values(currency) from the list

Decimal totalReceived = 0.00; List<Money_Received__c> moneyReceived = [Select Amount_Received__c,Reservation__r.Total_Recieved__c from Money_Received__c where Id =: reservationId]; for(...
0
votes
1answer
56 views

Need Help with a Map

I need to create a map between a custom object and a List, my code right now is this: Map<Invoice_Header__c, Contact> headersToContact = new Map<Invoice_Header__c, Contact>(); List<...
0
votes
2answers
43 views

how to get a value after from result callout

I have the following where the result format of the callout is the following: [ { "uid": "72852a55-5be3-496c-904c-fc3fd261f0a4", "name": "Responseev Agency" }, { "uid": "66852a55-...
1
vote
1answer
64 views

Set<sobject> doesn't maintain uniqueness although I am fetching Id field

I am trying to upsert a list of records and I may get duplicates so what I did In loop I am adding records to a set then that set into the list for DML. Now problem is coming when I add a record in ...
0
votes
2answers
41 views

How to return null for list if we have too many records?

How to return an error msg, if boxes are more than 1000 and we can't return this list (return null + msg)? We need to do that with if or with try catch? Or we can try both variants? @HttpGet global ...
0
votes
1answer
87 views

Callout error Invalid conversion from runtime type List<ANY> to Map<String,ANY>

I just followed a trailhead on callouts and I am trying to get some values from an endpoint. My debug shows me my status is ok but I get an error on line 17: Callout error Invalid conversion from ...
0
votes
1answer
40 views

Update list from static method

I have a static method and it has this annotation @RemoteAction so it can be called from java script, I query a list in this method and I want to change a field value and update the list, this doesn't ...
0
votes
1answer
32 views

Invalid Bind expression type of <sobject> for id field SObject Account

I'm getting this error "Invalid Bind expression type of Class_Detail__c for id field SObject Account" Class_Detail__c.Student__c is a Master-Detail relationship field to Account. Basically I want to ...
2
votes
2answers
71 views

Lightning component attributes: Difference between Array and List

According to this document, the type type[] is "An array of items of a defined type" and the type List is "An ordered collection of items". I've tested the output of both structures (with integer ...
0
votes
2answers
20 views

Is there a list of every fields of every SF standard object?

Is there a list of every fields of every SF standard object ? I know how to have each field of an object in different ways.. I'm sure it would be possible using code, but it's for a collegue of mine,...
3
votes
1answer
24 views

apex - Internal server error when getting Element of a List of Maps

I am passing a List of Maps to my controller from the client-side javascript, and when trying to access an element of this list, an internal error is thrown. Here is an example of the problem : ...