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
20 views

Creating Utility Classes - Batching sObject list

My goal is to create a reusable and scalable utility class that can perform different DML operations. I'm aware of the 10,000 DML processed records limit so I'd like to check if the list is greater ...
0
votes
0answers
18 views

Does anybody know why some listID are numbers and others are alphanumeric?

I'm working whit MobilePush List. I run this query: SELECT SubscriberKey, Status FROM _ListSubscribers WHERE ListID = '7890d736-7f37-ea11-a2e9-1402ec938f98' and returned the following error: Query ...
0
votes
2answers
40 views

SOQL SORTING WITH 2 FIELDS

I have the object Animal__c, with the field ZooId. I want to make an SOQL Query with the animals sorted by CreatedDate DESC and Zoo Id. Now the list is: Animal 0 ZooId 5 CreatedDate Yesterday ...
1
vote
1answer
50 views

Explanation of an notation List<name.test> nameList

I have a piece of code as following: List<name.test> nameList In List is name a class or object. Why would we use such an annotation? Or for example: method(name.test variable)
1
vote
2answers
34 views

Select records from a List with a specific RecordTypeId

I have a List of the object Animal, with records from two different record types, How can I return another List with the animals with one of those record types?? Preferrably using a query instead ...
0
votes
0answers
11 views

AgentWork object

I am working with the AgentWork object, the thing is several AgentWork are being created with the same WorkItemId, when its status changes. My doubts are: First, I do not understand why several ...
0
votes
0answers
52 views

Break a list of id's to multiple list into equal number of records [duplicate]

I have created a list of id where i am adding record id of a custom object. List<Id> validProjectId = new List<Id>(); validProjectId.add(project.id); Now that this list has suppose 1000 ...
0
votes
1answer
30 views

Try Method in Debug Window

this is my first post, I don't speak english...ok. I will consume an API and I have this method: public without sharing class BP_ExpiredProductsCtr { public static id accID; public static void ...
0
votes
1answer
21 views

Hot to get value of relationship dynamic Soql

I am using the following string in a dynamic soql: SELECT id, name, orderdate__c, status__c, sold_To_Customer__r.id, sold_To_Customer__r.name, sold_To_Customer__r.customerreference__c, ...
0
votes
1answer
27 views

How do I check if a list-value from my Map is empty?

I get this error in case if Opportunity__c has no OpportunityInfo__c. I try to check it with the condition if(opportunitiesMap.get(actualTool.Rent__r.Opportunity__c).OpportunityInfo__r != null), but ...
1
vote
1answer
39 views

Is there a simple way to get the values of a list in a comma separated string all in once

I have a custom metadata type in which I want to add the API names of some custom fields to use the values in a Dynamic Soql. I used a list to get the values of the custom metadata fields. Is there a ...
0
votes
2answers
30 views

How and where can i use map along with list/set collection to get unique output

When I enter united states I need only one language. If I selected wrong language it want to throw an error. Map<String,String> countryMap = new Map<String,String>(); ...
0
votes
1answer
43 views

Trying to see if a Custom Field Value starts with any names from a Custom Metadata Type

I'm extremely new to APEX, but it seemed like this was a simple enough requirement. I have a custom field on the Account Record, and a list of 'bad codes' as a custom metadata setting. I need the ...
1
vote
1answer
24 views

Inserting dependent objects without using a loop

I have this issue. I have a list of Contracts and I need to create Cases and custom objects called 'Budget' that the Case needs to lookup. The code can be summarized to something like this for(...
0
votes
1answer
29 views

Transform Integer list into moving sum list

I have an Integer list, which has to be transformed into moving sum list: [ 1, 1, 1, 1, 1 ] => [ 1, 2, 3, 4, 5 ] [ 10, -10, 10, -10, 10 ] => [ 10, 0, 10, 0, 10 ] But I'm struggling, how to set ...
0
votes
1answer
32 views

How to set default value for List<Id> parameter and use it as argument

I have List as a parameter of the method but get the error when saving the class Error: Compile Error: Method does not exist or incorrect signature: void createEmailMessage(Id, OrgWideEmailAddress, ...
0
votes
1answer
35 views

How to avoid multiple soql queries?

I am working on something that requires insert, update and delete actions on Account object. I have written the below code but would like to know if there's a better way to do this by using maps ...
0
votes
0answers
49 views

Fix the logic for proper comparison using a Map

I'm trying to check and change the Client__c value in Mopping__c if the In_date__c has changed in the needed Rent__c. There is a lot of data, therefore Map is used. Structure: if Mopping 1 is related ...
0
votes
1answer
15 views

How to get a List Element of a Map

I have a map Map<Id, list<Boolean>> mapOfIdAndListBoolean = new Map<Id, list<Boolean>>(); I think I can get the whole list by using mapOfIdAndListBoolean .get(order.AccountId). ...
0
votes
0answers
14 views

MC stored Opt In Status from List into Data Extensions

The problem in our sales cloud/marketing cloud construct is that the opt-in must be stored in our marketing cloud and there is no field in the sales cloud for it. As I understand it from my research, ...
2
votes
2answers
44 views

SOQL - Best practise : what method choosing while retrieving datas?

There are multiple ways of let's say instanciate a list of contacts using SOQL ; My question is : is there a difference between each other, and is there a best practise ? Examples String name = '%a%'...
0
votes
2answers
26 views

Unable to access versionData from test class

I am facing an issue but I don't know what I'm doing wrong. I'm writing a test class for a code which has this 2 lines: public static Blob getPkpass(){ // more code here... List<...
0
votes
1answer
61 views

Add event listener for window resize in lightning web component

I want to ad an eventListener for window resize inside my custom lightning web component but I don't know how to do it Maybe something like this? constructor(){ window.addEventListener('resize', ...
1
vote
1answer
78 views

Converting list into Integer

I have 2 string fields in database one is a name and the other is semicolon-separated values, I want to put the name and its summed up values in a map to use it later in the code. I can split the ...
0
votes
1answer
43 views

Marketing Cloud: Using Publications Lists to Update Salesforce Contact

I am leveraging Publication Lists in Marketing Cloud to manage unsubs from unique Business Units so that a contact can choose to unsubscribe from one business unit but not all. I also need this to be ...
-1
votes
1answer
66 views

How to avoid duplicates in Map and make the comparison correct?

I have a code to compare then values from list and from map. But I'm getting duplicates in my map and only one map value in the loop later. How can I fix it? List<Tool__c> tools = [SELECT Id, ...
0
votes
1answer
41 views

Duplicate id in list: broken script

I have a script: List<Apartment__c> apartmentsToUpd = new List<Apartment__c>(); List<House__c> houses = [SELECT Id, Tenants__c, EntryDate__c, DepartureDate__c, Opportunity__c FROM ...
2
votes
0answers
41 views

“Automatically Refresh Upon Sending” list function doesn't work

In Salesforce Marketing Cloud, the button "automatically refresh upon sending" present in every contact list doesn't stay on after clicking on "Change" and setting it to "On". After the page is ...
0
votes
2answers
43 views

Apex: Duplicates in list when adding set to empty list

I came across a weird behaviour of which I don't know why it happens. Maybe you guys can help me: Setup: I have a list of records, over which I iterate (list name: fieldAutomations). Each iteration ...
1
vote
1answer
36 views

Help with “Duplicate id in List”

I've recently started at a new company with a completely different instance. Recently I've noticed a growing amount of errors looking like CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY: CaptureCard_Trigger:...
-1
votes
1answer
40 views

calculate the total of a variable based on another variable in JS controller lightning

finalMap=[{"key":"OTC","subprocessName":"CXO","weightage":50}, {"key":"OTC","subprocessName":"Order Management","weightage":50}, {"key":"RTR","subprocessName":"Fixed Asset Accounting","weightage":20}, ...
0
votes
1answer
41 views

For loop conditional statement for if a List<Contact> contains an element

I have some code like this. While the conditionals I have are working fine what I cannot check for is if Contact lCon is NOT contained in the sfdcList. I have been trying to find a way to set up a Set ...
0
votes
1answer
62 views

Sorting a List of different object Lists by datetime

I have a List<ListWrapper> comprised of List<Knowledge__kav> and List<Community_Event__c>. I would like to sort List<ListWrapper> by date but the two inner lists have different ...
0
votes
1answer
43 views

For loop to check if a list contains a string

I have a picklist on a visualforce page and I'm trying to filter by namespace prefix to display objects belonging to a package as well as the account and contact objects. I have the for loop below ...
0
votes
1answer
40 views

Iterating Through a Map<Id, List<Contact>>

This is a concept I am having a bit of trouble understanding. In this particular case I have debugged each piece within it and I can get the values I expect, But I am not able to iterate through them ...
0
votes
2answers
134 views

How do I delete all subscribers list in child BU without affecting Parent BU in SFMC Enterprise 1.0

Can someone please help with the below issue. I have a scenario, we had a new child BU with zero subscribers in all subscribers list ( SFMC Enterprise 1.0 ) I have imported few contacts manually ...
0
votes
0answers
25 views

Populating a Map<Id,List<Contact>> for a comparison

What I am trying to do here is populate a list from a callout to Looker (BI Tool) then create a Map of Salesforce Account IDs to associated Contact Emails. To do this I created this method: public ...
0
votes
1answer
275 views

Database.Query does not return fields with null value

Hi i'm executing this query using Database.Query(query) Where query is SELECT field1__c, field2__c, field3__c FROM Object1__c On the current record, field3__c is NULL but when i query on the ...
0
votes
2answers
87 views

Illegal assignment from List<Set<Id>> to Set<Id>

I have two maps like below: Map<String,Set<Id>> emailMatchingContacts = new Map<String,Set<Id>>(); Map<String,Set<Id>> epostMatchingContacts = new Map<String,...
0
votes
1answer
33 views

Map Problem: Connecting multiple keys to a single list

I'm having an issue with the Map Collection. I'm trying to merge some duplicates. I have value that identifies the dupes Number__c and is appearing on multiple accounts that need to be merged. I'm ...
-2
votes
1answer
59 views

Convert string representation of array to Apex Array

*Edited to correct JSON string I have a string which looks like: "[[[1,2],[3,4],[5,6]]]" I need to convert it to Apex array like: [[[1,2],[3,4],[5,6]]] Using JavaScript I am able to simply pass ...
-2
votes
1answer
39 views

SObject row was retrieved via SOQL without querying the requested field: Webinar_Attendees__c.Voucher_Assign_Date__c

'm trying display parent fields and sub query fields in a table.But I'm unable to display sub query fields.Could anyone suggest an idea for me Page : ====== ...
0
votes
1answer
234 views

How does one populate a Lightning component combobox with a list of records (id/name)?

I have a Lightning component in which I want to display a list of records related to an Account. I currently have this (but it doesn't work): My Component display: <aura:if isTrue="{!not(empty(v....
0
votes
1answer
75 views

Apex add list elements inside json without ()

List<List<String>> listaCot = new List<List<String>>(); detalleCot = '{"Cdocu":"31","Ndocu":"","Codi":"'+variable+'"}'; listaCot.add(new List<String>{detalleCot});...
0
votes
0answers
75 views

Remove parentheses from list in apex

I have this list. when i print it: System.debug(listaCot); //it shows this ({"Cdocu":"31","Ndocu":"","Item":2,"Codi":"0301-011626","Codf":"45TEL080075C009"}), ({"Cdocu":"31","Ndocu":"","Item":2,"...
0
votes
0answers
24 views

Error when storing SOSL Result into other list “Final Exception : Collection Is Ready Only”

I have written a SOSL query to search on a Custom Object and a Standard Object. When I am getting the results from it, then I am trying to store the value of fields into a set, to do a SOQL query ...
0
votes
2answers
44 views

apex add list to list

I have this code: String cantidad; String total; List<List<String>> pList = new List<List<String>>(); List<String> lstStr = new List<String>(); List<...
0
votes
0answers
33 views

What is the best way to populate a map from a list conditionally?

I would like to know if there's a better way to populate a map from a list where conditions apply as to whether the list item is to be added to the map or not. For eg I have a list of objects ...
3
votes
0answers
45 views

Case standard list controller won't show any records on visualforce page

I am new to Visualforce, and for the life of me I can't get a case standard list controller to show cases. It works for Accounts and Contacts, just not cases. Here is the code: <apex:page ...
1
vote
1answer
58 views

Error: Compile Error: Unexpected token 'List' (SOSL query)

In "Jeet Singh" visualforce tutorial, there is a part talking about search operation, but I get the error when trying to save the code below, I copied exactly the same. any idea why? public class c6{ ...