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
2answers
44 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
224 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
42 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
46 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
2answers
67 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
53 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
76 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
68 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
329 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
293 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
1k 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
49 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
29 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
36 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
12 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
151 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 ...
1
vote
2answers
2k 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
34 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
416 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
379 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
247 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
64 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
313 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
68 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
47 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
2answers
2k 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
102 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
505 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 ...
3
votes
2answers
539 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
358 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
189 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 : ...
6
votes
2answers
355 views

What is the difference between using the LIMIT clause and using a fixed index to retrieve data from a query?

This code recover the exact same account, I thought there could be differences with the way it ask the database ... Seems not to be the way it works, So an idea ? public static void ...
1
vote
1answer
667 views

How to put a list in the parameter for class and use its variables?

I have a JSON and I need to pass the data to a list, then use it as my class parameter. I've managed to pass JSON to a List, but when I put it in the class, it throws the following error: "global ...
0
votes
2answers
88 views

Add list in another list (building hierarchy tree)

I'm new to Apex (actually in programming in general) and am trying to build a hierarchy tree with 4 objects: Account, Carteira__c, Produtos_das_carteiras__r and AtivosFundo__c One Account can have N ...
0
votes
1answer
19 views

How to get api names and their value from list

Can anyone please help me with following issue I am having a list of opportunity contains 3 fields value for opportunity. List<opportunity> listopp = new List<opportunity>( ); listopp....
5
votes
1answer
2k views

How to efficiently combine 2 Lists<Contact> if the same Contact is in both

I have 2 lists of Contacts, which may both contain the same Contact(s) or they may not. I have a method that combines the lists, meaning if a Contact is in both lists it will take the Contact's ...
0
votes
3answers
47 views

Filter duplicates from List Query

I am trying to filter the duplicate based on a custom field. Its working fine but it is filtering only one duplicate. if there are 3 records, its showing 2 records. The below is my code. List < ...
3
votes
1answer
50 views

Exit customer from welcome Journey - After click/subscribe

I am trying to launch a welcome series with the intent to get the subscriber to fill out their profile. I am using Journey builder to do it. I want to exit the Jounrey when the subscriber visits the ...
1
vote
2answers
2k views

Understanding All Subscriber behaviour in Business Units

Setup In our SFMC instance we have a parent BU and two child BU's mapped to it. I also have data extensions within the child BU's that contain Contact records from our integrated salesforce CRM ...
-2
votes
1answer
993 views

How to bind list of string in dynamic SOQL

List<String> cityList = Label.cityNames.split(','); String SOQL = 'Select id, name from Account where city IN:cityList' Databse.executeQuery(SOQL); Could you please correct the above ...
0
votes
1answer
428 views

Unordered List with no bullets not working with email template

I have a Visualforce Component that has a un-ordered list. I want that list to have no style other then the indentation. Usually with HTML you would just specify the ul css to be list-style:none or ...
0
votes
1answer
44 views

Conversion of a list to map with key as Account and map as account's corresponding contacts from a list of accounts

I have a list accountList which contains corresponding contacts aswell. Now I am trying to make a map from that list with key as single account and corresponding associated contacts as value. public ...
0
votes
2answers
425 views

Marketing Cloud sending Content Builder Email to List

I have created a list (using SOAP API) and know the ID of this. The HTML Email exists in Content Builder, I know the name and the ID. How can I send the email to the list. This is not a triggered ...
0
votes
1answer
270 views

Illegal assignment from list to list for custom class and aggregateResult

I have a custom controller and visualforce page. The page loads fine with the SummaryList. When the user enters parameters, it should filter the list according to the runSearch method. I'm getting an ...
0
votes
3answers
478 views

Insert 2 objects (parent and child) at a time (over 200 records)

I have over 200 records, and I need to insert 2 lists. Work's records are created too fast and can't take a customField from still not inserted Case. If insert 1 per time - Error: Too many DML ...
1
vote
3answers
3k views

How to sort a list of strings in the descending order?

I'm trying to sort the list of strings which has versions but fail to do this: List<String> src = new List<String>{'7.1.2', '8.1.3', '11.0.5', '5.x', '10.0.89', '12.13.14'}; List<...
4
votes
1answer
521 views

Deserializing a list of jsons

I am trying to deserialize a list of jsons. If I have only one json like so '{"apple":"green"}' I can parse it using JSON.deserializeUntyped: Map<String, Object> input = (Map<String, ...
0
votes
1answer
77 views

Display Relationships Between Lists on Visualforce Page

I have a list of strings. I am using these strings to populate three other object lists by querying for this string. For every iteration I am adding the lists populated to a List of lists. Ex: ...
0
votes
1answer
58 views

Compare field to large list within Salesforce

I have a large list of email domains that I would like to use for comparisons within some apex code (for example, does the Contact's email domain name exist in this list). What is the best practice ...

1 2 3
4
5
14