Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

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
39 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 ...
-4
votes
0answers
28 views

Variable does not exist: ListUsage [closed]

public class ListUsage { public static Integer value = 0; public static void listuse(){ value++; /*sytex for list List<Dtata type> = new List<Dtata type>(); */ List<...
1
vote
1answer
22 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
28 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
29 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
33 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
48 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
11 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
42 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
24 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
29 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
76 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
30 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
64 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
39 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
40 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
22 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
34 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
38 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
41 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
37 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
39 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
86 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
134 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
67 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
53 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
132 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
43 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
59 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
32 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
30 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
40 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
43 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{ ...
0
votes
1answer
29 views

Method updates all records inside <list> - should update only 1

I have implemented the following visualforce page on the lead layout: Here is the code: .hmk_top5table{ color:black; width:99%; font-family:Arial, Helvetica, sans-...
1
vote
1answer
25 views

Can't retrieve a different attribute than status from a list through SSJS

I am trying to receive a specific subscriber from a list by using the email address as an identifier. After I have this subscriber I want to print out it's subscription status. So far I am still stuck ...
0
votes
1answer
41 views

Retrieve and update attribute data from a list

I am building a cloudpage to replace the standard subscription center. I want handle the email list subscriptions in there through checkboxes. I am already stuck at visualizing the subscription lists....
0
votes
1answer
57 views

Aggregating a list of records into two buckets

I have a list that has 2 months worth of records i.e MTD and Previous month. This list is built from JSON response. SubmittedDate IDL (yes/No) SubmittedCount 2019-07-01 Y ...
0
votes
1answer
17 views

Alert user when updating child record based on other related child records

I am trying to display an error when updating a child record. Here's my scenario Parent Bank__c Child Branch__c Relationship field on child BankId__c Updating field on child checkbox Primary_Branch__c ...
0
votes
0answers
39 views

Unable to add data to Data Extension using Automation script Activity

I am trying add data that come from response of SOAP API to get data from list in data extension If response contains 2500 records then I am using for loop to add this data one by one in data ...
1
vote
1answer
44 views

SObject List vs Map instanceof subtype

Map<Id, SObject> sObjectMap = new Map<Id, SObject> (); System.debug(sObjectMap instanceof Map<Id, Account>); // false System.debug(sObjectMap.values() instanceof List<Account>);...
0
votes
1answer
15 views

List type method created and return the same list getting error in return type

Working for pagination on custom object record, using StandardSetController everything initialized but it is giving error that Error: Compile Error: Unexpected token 'return'. at getAgentAsset ...
0
votes
0answers
12 views

Grouping Filtered Records on a Visualforce Page by a Field

I have a custom object called "Availability" that has a couple of field that I'd like to display and I want to be able to filter them by a date range selected by the user through the VisualForce page ...
4
votes
1answer
264 views

Attempt to de-reference a null object: list initialization

I initialize the list at the beginning of the code. In one of the methods, I add values ​​to it. In another method, the list is already empty. But I need these values ​​in the second method. How to ...
0
votes
1answer
99 views

Using AmpScript to update All Subscriber List

Here is my code that executes after a submit button is pressed on a cloudpage %%[UpsertData("SubscribersTester", 1, "Email Address", @subKey, "First Name", @Fname, "Last Name", @Lname, "Monthly"...