Stack Exchange Network

Stack Exchange network consists of 175 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.

0
votes
1answer
15 views

Using both lists and data extensions at the same time in for email and SMS sending?

So I know this isn't the best practice but is it possible to use both lists and data extensions in marketing cloud without any complications? Use case could be like: I use lists when I want to send ...
0
votes
1answer
23 views

Putting a List Inside the value of a map

I am getting an error Error is in expression '{!setGroupBy}' in page customjobapppage: I tried multiple approach and I ended up with this: so this is how i Initialize my map public Map<...
0
votes
1answer
16 views

pass list<string> value in test class

In my class one list of string is there which is get;set; type. i want to pass the value in test class how to do this public class MYController(){ Public list<string> selectedDelList{get;...
0
votes
1answer
41 views

List items not getting removed

I want to remove Accounts from List to which user doesn't have access. Here is my code. However in the debug logs, I can see all the accounts, that is none of them are removed. query += QUERY_BASE + ...
0
votes
1answer
39 views

How to identify similar records in a List and then updating corresponding fields

trigger setCertificationToFailed on Exam__c (after update) { List<Exam__c> ExamList = new List<Exam__c>(); ExamList = [SELECT Id, Exam_id__c, Exam_state__c, doNothingExam__c, ...
0
votes
1answer
29 views

How to iterate map and assign value to field in lightning component?

I have list of account Ids in an array and list of accounts in array. I need to find the account Ids from the account list and want to change the status field. var accId=[]; //holding accIds var ...
6
votes
1answer
225 views

How can I query the supported timezones in Apex?

Apex provides a TimeZone API. You can use this to query the detail of a time zone, named using its "SID" (a value like "Europe/London" or "America/New_York" for example). However, this API doesn't ...
7
votes
2answers
118 views

SOQL: Populate a Literal List in WHERE IN Clause

I need to query for an object based on 2 string variables. The first one is a constant but the second one gets passed to the class constructor. So in the end I want to achieve something like this: ...
-1
votes
2answers
50 views

How to remove list elements without an additional for loop?

I need to remove from the following revenueList list all elements where newRevenueDate is NULL without any additional for loops. List<Revenue__c> revenueWithNoDateList = new List<Revenue__c&...
9
votes
1answer
52 views

How can I safely cast a List<sObject> to a specific concrete type?

I have a List<sObject> genericList in scope in a method. The list was created and populated elsewhere and passed in as a parameter. It could be: a List<sObject> that is homogeneous. E.g. ...
0
votes
1answer
22 views

Where to look for in debug: list index out of bounds

I am trying to debug a piece of code where I get the error : list index out of bounds: 0 In this case do I need to look for:ZcheckoutBaseFor.validateConfiguration() or could this also be :...
0
votes
1answer
24 views

Error trying to remove account from list

When I run the button this error appears: Cannot modify a collection while it is being iterated. public void removerConta() { List<ContaVinculada> listContasRemover = new List<...
0
votes
1answer
23 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
107 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
23 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
28 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
161 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
35 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
28 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
33 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
45 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
21 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
80 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
84 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
88 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
128 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
93 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
65 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
66 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
30 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
38 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
51 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
28 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
33 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
42 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
30 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
48 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
37 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
23 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
35 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
211 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
19 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
114 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
96 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)?