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.

Filter by
Sorted by
Tagged with
0
votes
1answer
342 views

Batch apex for account merge DML operation

I have a requirement where I need to merge accounts if a particular field 'vendor_code__c' value is duplicate across the accounts.There is also 2 condition that the :- 1st condition Account of record ...
1
vote
1answer
3k views

System.assertEquals for records in a list? Test class

I have a batch class that inserts Journal records after updating Account records... I am new to apex and cannot think how to test the inserted records in the test class. I have a list to get the ...
2
votes
1answer
25 views

How To get dom documenet value list

Http h = new Http(); HttpRequest req = new HttpRequest(); req.setMethod('POST'); req.setHeader('Content-Type', 'text/xml'); req.setHeader('SOAPAction', action); req.setEndpoint(ep);...
0
votes
1answer
217 views

Retrieve All Subscriber where Add Method is 'Import'

I would like to retrieve All Subscriber from a List where the Add Method is 'Import'. I tryed do a query like this: SELECT * FROM _ListSubscribers WHERE ListID = 2677 AND addMethod = 'Import' But ...
0
votes
1answer
778 views

Assert Map<String, List<sobject>> has multiple values in list

I have a method that returns: Map<String, List<Account>> results I want to have a test class that asserts that the map contains two list records with one string value. I can't figure out ...
0
votes
1answer
61 views

How to test a retun value fom a private class

I have a class where I return a list, how do I pass the retun Value in a testclass. Currently I get the error Variable does not exist: lstRet public static String getPicklistData(String objectName,...
0
votes
1answer
512 views

Deployment error System.ListException: List index out of bounds: 0

I have the following apex code where I do a soql. In my developer sandbox my testclass gives me 100% coverage. When I deploy this to production I get the error: System.ListException: List index out ...
2
votes
1answer
125 views

apex - remove item from dynamic list

The regular Salesforce community sent me here to ask these questions. I'm pretty new to apex and controllers so I'm not sure if I Googled it correctly so please be gentle if this is a super obvious ...
2
votes
1answer
691 views

List.indexOf does not exist?

I have an error in a method using List.indexOf. When running in anonymous window in sandbox, it works. But in production I get the following error: Method does not exist or incorrect signature: ...
0
votes
1answer
884 views

System.ListException: List index out of bounds: 1 in apex share

I am getting below error and not sure how to fix that ? List<Case> csList = [Select Id,OwnerId, (select Id, OwnerId, CreatedById from Payment__r), (select Id,OwnerId,...
1
vote
2answers
145 views

Pass a list collection from a search to new filtered list lightning controller

I have followed a tutorial to create a custom search lightning component to search a list of contacts based on an event search which works fine. What I would like to achieve is to get the result of ...
0
votes
1answer
414 views

System.ListException: Before Insert or Upsert list must not have two identically equal elements for my DML operation [duplicate]

I have below code where I try to insert an SObject and getting an error as mentioned in subject. I have tried to fetch newly inserted records of say Object1, and putting them in Object2 lookup field ...
2
votes
1answer
617 views

Collection store exception adding all List<Opportunity> to List<Account>

I a have a problem in my code, i try to merge two lists into a Sobject list in order to optimize the DML operation, but i get this error during run time: Collection store exception adding all List<...
1
vote
2answers
69 views

Can I update field to same value for every row in a list?

I want to update a field to the same value for every row in a list all at once. For example: List<Opportunity> osl: [SELECT Id, CloseDate from Opportunity WHERE CloseDate !=: today; osl....
2
votes
1answer
1k views

Is it possible to cast an sObject to another object that is dynamic?

I'm having a problem with my code because I need to get a list of records of a dynamic type, and that is working alright, but then I need to use some of the fields and can't reach them, giving me the ...
1
vote
1answer
820 views

Displaying map in Visualforce - key with List<List<>> values

I am trying to use a data map to display information in a visualforce table. I have tried many of the suggestions in similar questions but no luck yet. My relevant controller code follows: Public Map&...
0
votes
1answer
532 views

Deleting list from pardot

I have many lists in Pardot. Some of them are tied to automation rules. When I try to delete a list, it shows "List is in use by one or more dependencies". Is there a way that I can know which are the ...
1
vote
2answers
40 views

Create 3 record from 1 record

I have one custom object which I wanted to create 3 records from 1 record. Basically the requirement is, I have a field amount (ex as 100 $) which should be divided into 3 different records of amount ...
1
vote
1answer
745 views

Array or List of Big Objects as parameter for AuraEnabled controller

Does Salesforce support passing an array or list of big objects as a parameter for an AuraEnabled controller method? In other words can I pass from a lightning component javascript controller an array ...
-2
votes
1answer
128 views

String List Used to reference String in Class

I am trying to use a string list and it's values to represent members of a class, but it is taking the variable literally and returns that the variable does not exist. Is it possible to reference an ...
0
votes
2answers
427 views

APEX - Get Attribute Class List / getPopulatedFieldsAsMap()

I keep receiving the method does not exist error. With the below code. Here is my searchClass definition: public class searchClass { public Integer item_count; public List<Accounts> ...
0
votes
0answers
21 views

Updating a value in the list to be updated before and after the dml operation

Im trying to update child record in parent after trigger, where i need to update this child's boolean (MA_Campaign_Qty_Boolean__c) as part of restricting some validation in child's trigger for this ...
0
votes
2answers
225 views

SOQL Query - Where Condition

I have below query to search for Existing Contact before creating new Contact in Salesforce. If there is a Contact with matching email and another Contact with matching Phone - results are not ...
4
votes
1answer
395 views

Generic parameter not accepted for sets?

While working on some code for a utility method to remove values from a List, I wrote this method signature, which accepts a List<Object>: public static List<sObject> Exclude(List<...
2
votes
1answer
197 views

Sort a list of tasks by date value

I'm trying to sort a list of tasks by their due date in ascending order. I've looked in a couple of forums and none are what I exactly need. I'm sure this should be relatively easy but haven't found ...
-1
votes
1answer
298 views

convert Map<id,string> to list<Order.Product> in test class

I have a method return type of map which I need to convert to list<Order.Product>.Here Order is main class and ProductOrder is inner class which has variables. I have assigned the map to list ...
1
vote
1answer
3k views

Adding to sub list/array within apex wrapper class

I am trying to figure out how to add to this wrapper class. public class Invoice { public String Type; public LineItem[] LineItems; public class LineItem { public String ItemCode; public ...
0
votes
1answer
45 views

Custom Field Data type converting to DateTime in Apex Collection [closed]

I have a custom field with data type "Date" and when I run a query in the dev console the date returns as expected SELECT customfield_date__d from myobject 2017-10-03 When I query against the ...
0
votes
1answer
27 views

Want to display parameters in single table from multiple lists based on common parameter [closed]

I have two lists which are populated by REST Response. The First list is List<Business> Abc and second is List<Sales> xyz. 1) List<Busiess> Abc have below parameters: AccountNumber ...
0
votes
1answer
157 views

Salesforce Invalid conversion from runtime error - Map

I'm making a callout to an external API via Apex and processing the response as such: HTTPResponse res = http.send(request); Map<String, Object> Response = (Map<String, Object>)...
2
votes
1answer
367 views

Can't populate a List in a loop

I have this below code where I am trying to populate the List 'facList' in a loop will different facilities but its populating only the last facility multiple times. What am I missing here? If I ...
-1
votes
1answer
342 views

Visualforce Error List index out of bounds: 0

I have a visualforce page which returns the error: Visualforce Error List index out of bounds: 0 , I figured out that my list is empty but how kan ik render my visualforce page without the empty list ...
3
votes
1answer
770 views

Sort wrapper list in Apex based on Levels

I have created a wrapper which contains an account record and a string describing the level of account Platinum, Gold, Silver. public class PartnerWrapper implements Comparable { public Account ...
0
votes
2answers
576 views

From Soql to map<string, list<string>>?

I am trying to find all the leads with email campaigns then make a list of the hashed email addresses for those leads for each of the leads owners. So Shays list would have every email address of the ...
0
votes
1answer
120 views

Generate a list in customer journey

I'm wondering if exists a way to generate a list of subscribers at a certain point of the customer journey to retrieve customers arrived to that point and their individual engagement.
3
votes
1answer
234 views

Map behaviour populating with List

I've noticed some strange(?) behaviour with Lists and Maps. Below is a snippet of code: // Query for a List of Accounts List<Account> accountList = [SELECT Id, BillingStreet, BillingCity, ...
1
vote
2answers
514 views

loop through accounts and update

I am currently updating contact related records on accounts which updates my contacts correctly. When i try this for account I get the error: Method does not exist or incorrect signature: void ...
0
votes
1answer
61 views

Associate a record from 1 custom object in the related list of 2 custom object

I have two custom objects: x__c and y__c. I have multiple records in y__c object. This object is displaying as a related list on x__c object. I want to create a button which will take records from ...
1
vote
2answers
2k views

Delete failed. First exception on row 0 with id xxxxxxxxxx; first error: ENTITY_IS_DELETED, entity is deleted: []

I am trying to Upsert bulk records in Custom object using dataloder. I got error like: FATAL_ERROR|System.DmlException: Delete failed. First exception on row 0 with id xxxxxxxxxx; first error: ...
1
vote
1answer
53 views

List is returning no objects

I'm getting an odd error when trying to pull a value in a list. I know the error is due to no rows however it fires the exception on row 0 which is odd to me. Any help would be great. Here is the ...
0
votes
1answer
35 views

Old unchanged Test Method Fails during deployment of unrelated code

There are similar questions but they hold no answers and are not specific. Error Message / Test Failed during deployment of unrelated code: Test_Method_Test ThisTest System.ListException: List ...
1
vote
1answer
152 views

How can I update Child records from list of Parent Records in custom controller?

I have a custom controller with a list of parent records (opportunities) and a list of their child records (opportunitylineitems). I want to save both the parent fields and child fields with one ...
2
votes
1answer
279 views

All possible combinations of values in two lists [closed]

I have two lists, let's do: L1 = {A, B, C} L2 = {A1, C1, C2} List L2 contains duplicates of values in list L1. Each value in List L1 can have one duplicate in list L2 (as "A" and "A1" in the e.g.), ...
0
votes
1answer
549 views

How to get the row data in apex pageblocktable to update the list in apex class

Im planning to update each row using actionSupport event = "onchange". I'm trying to get the ID of the row but it is NULL. Or Is there any way It can be updated as a list without using the ...
0
votes
3answers
70 views

set to string conversion

Set<ID> objIDs = new Set<ID>(); //objIDs is used to store the user Id's i have two id in ObjIDs, for example: 0054E000001jEoUQAU, 0054E000001lC07QAE. How to query the email address ...
0
votes
1answer
47 views

Triggering an email from a new list entry in Marketing Cloud

Does anyone have any idea about a way to trigger an email when a subscriber is added to a list in Marketing Cloud? A 3rd party is sending us subscribers but their standard integration creates list ...
0
votes
1answer
33 views

ERROR: CustomerTrigger: execution of BeforeUpdatecaused by: System.ListException: Duplicate id in list:

I have written one trigger on before update. On customer object -before edit i need to save changes in Test_c object. trigger CustomerTrigger on Customer__c (before update){ list<test__c>...
0
votes
1answer
644 views

Sorting a keySet

I have a list that I created with a Wrapper Class and a Comparable/compareTo method. So it is sorted the way I would like it. From this list I created a Map with the key being the list's Created Date. ...
0
votes
2answers
99 views

Created a dynamic string and want to fetch list size on the basis of that string [duplicate]

I have an object that is having multiple child objects. I want to perform certain actions only if the current record has child records associated with it. For this I am checking the related list's ...
0
votes
1answer
152 views

Populating Account Name to Task from Account or Opportunity

I want to record the Account name to the Task so I can use it for things like email alerts. I have found code allowing me to add the account name from the Account when the WhatId is an Account. I want ...

1 3 4 5 6 7 14