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
2
votes
1answer
48 views

Merging two lists into one

I have two different lists. A list of opportunities and a list of sales (Umsatz__c), the accountid appears in both lists. How can I merge these lists into one finallist at account level? This list ...
0
votes
1answer
58 views

Check particular value in a list

I have a list. In the list, I have ids and names. May I know how to check if a name is in the list or not? Its like if the name 'Ali' in the list, OwnerID = id [Id value takes from the list] trigger ...
0
votes
1answer
28 views

SOSL use FIND with bind list of Strings - Specified search expression can not be converted to string

I have a list of strings (phones) which I'm trying to use inside my SOSL Find clause and its giving me issues: List<String> phonesList = new List<String>(); for(Account acc : acclist) { ...
0
votes
1answer
32 views

How to access an list from a list which stores all the list names

List<string> lstStrng = new List<string>{'a','b'}; List<string> lstOfNames = new List<string>{'lstStrng'}; string name = lstOfNames[0]; System.debug(name[0]); I am ...
0
votes
2answers
40 views

How to show a list of ALL USERS NAMES who belong to a selected Group and a list of USERS who don't belong the selected Group

For the moment I have this Query: SELECT userorgroupId, GroupId, Group.Type FROM GroupMember WHERE groupId ='00G09000000vV44EAE' AND Group.Type='queue' I am ...
0
votes
1answer
31 views

Fill Map<String, List<Id>> from a list

I am trying to build a map<String, List<Id>> where the List<Id> is the list of UserOrGroupId field in the GroupMember Object that has similar Group.DeveloperName values and that I ...
0
votes
1answer
18 views

Create a method that invert 2 elements in a List<Integer>, should return the list with the numbers inverted.(indexes + list are passed as paramethers)

The goal is to invert 2 elements of a List. Like if I have List<Integer> integers = new List<Integers>{1,2,3,4,5,6,7}; If I call this method: invert(List: integers, index1: 2, index2: 3); ...
0
votes
1answer
26 views

Create a method which has a List<Account> as parameter that check for Accounts duplicate, must return an Account List

My method is adding the account to the list even tho' there isn't another account with the same name, I want to add just the duplicates to the list, any suggestions? global static List<Account&...
0
votes
1answer
21 views

Create a method that Concatenate Contacts Names from a List<Contact>

I'm testing my code, but it is not going within the for loop, does anyone have any suggestions? global static String concatenateNames(List<Contact> contacts, String separator) { List<...
0
votes
1answer
17 views

Add Lightning Avatars into a list of Different Results from a Customized SearchBar

I have a search bar which is showing the Users, Queues and Public Groups from the ORG, when you start typing on the search bar the different objects start to appear. I want to show the results with ...
0
votes
1answer
31 views

How to filter/split a large list based on specific column values?

I have a list with 50 thousand records. Want to filter those records base on Branch name column values. In the list Branch==>Temp has 3 records and Temp2,Temp3,Temp4==>has respectively 1 record....
0
votes
1answer
17 views

How to get the delegated Approver Email address?

I have logic in my custom code where I need to send an email to the custom approver and its delegated approver. But I am not able to get the email id directly in SOQL. List<Account> lstAcc = [...
-2
votes
1answer
48 views

Create Map from records of 2 List [closed]

I need to create map from 2 lists. One list ids and another list<custom_object__c> objects. But i dont get how to do it? id list is not id from custom_object__c. With on list it easy, but how to ...
0
votes
1answer
16 views

Get object record with unique field from list

I want to remove People__c record from list based on field value I have list of custom object People__c with field Responsible__c which is another object id. I am getting list of id and want to get ...
-1
votes
1answer
23 views

Invalid bind expression type of Task for column of type Id

I tried to get all related tasks from the selected contact, but salesforce don't like my code. If I try to save I get the error: Invalid bind expression type of Task for column of type Id What I'm ...
0
votes
1answer
55 views

How to sort a list of list

I am trying to figure it out how to sort a list of list using apex, like for example : Input : [[5, 'text1], [1, 'text2'] , [12, 'text3]] To obtain and ascending ordered list like that : Output: [ [1,...
1
vote
2answers
50 views

access individual field values from an object element in a list

What I am trying to do is to update a child object field (downloads__c) in each of the child records in the child object (Data__c) record collection, with the value of a field (downloads__c) from its ...
0
votes
1answer
34 views

Apex Class - List of records by record type that also reference a field value on found records

I don't write code, so bear with me. I have a portion of an Apex Class that pulls a list of record types for Cases. However, I need to add a criteria here that then looks at the received records and ...
-2
votes
3answers
43 views

How to pass a list from one method to another

I have three methods: Method1: public static void method1() { // call method 2 that returns a list method2(); // call method 3 and pass list retuned from method 2 method3(myList); } Method 2: ...
-3
votes
1answer
50 views

Remove field from object list in class [closed]

I have list of accounts and want to use them for post request. How can I remove unnecessary fields like id to set that list in setbody? Now I am just using for loop and json serialize. Some code. So I ...
0
votes
2answers
50 views

Get Id of the newly created record in Apex

I have the following Apex method: public static void createJourney(Id accountId) { // Step 1: get account record type Account accRecTypeName = [SELECT Id, RecordType....
0
votes
1answer
21 views

Search List for variable for comparison using contains

I am trying to find the Name variable in a list to use the contains() method to search for the Name of the Activity_Assignment__c but am getting an error: Method does not exist or incorrect signature: ...
0
votes
1answer
30 views

Method does not exist or incorrect signature from void type list

I have the following method: public static void updateCaseLastEmailStatus(List<EmailMessage> emUpdateCase) { Id caserecordType = Schema.SObjectType.Case....
0
votes
1answer
31 views

Send List Email Attachment Issue

my clients want a functionality to send bulk email with an attachment in jpg format, but in current scenario when I send an email the attachment is converted into .html link. please help if there is ...
0
votes
1answer
19 views

I'd like to get and print records that only apply to the desired values within the list

List<OpportunityTeamMember> opListId = [SELECT OpportunityId, UserEmail__c, id FROM OpportunityTeamMember WHERE OpportunityId IN :opId ]; I want to extract only records that meet the desired ...
0
votes
1answer
27 views

Update(reassociate) lookups on newly created object from an old object

What is a better way of writing the below code so I can avoid repeating similar lines of code for every lookup object that I try to re associate Here Speaker & Session are Lookups on Event Object, ...
0
votes
1answer
40 views

How can I map one record to another using a lookup field in salesforce?

I hope you are well, I would like to ask for your help with something that you have in mind and I can not do it haha If I have two different object record lists and the first record list has a lookup ...
0
votes
1answer
40 views

Using a String to access an object's parameter (APEX)

I have a list that contains an object's parameters that I'd like to access from the object. Below is an example of what I am trying to do //temp is the name of an object which contains all of the ...
0
votes
1answer
27 views

(How) can I create an email template which digests multiple instances of an SObject?

Let's say I have a custom SObject MyObject__c with a custom text field Message__c. Periodically, I want to send out an email which will collect all instances of MyObject__c which have the same value ...
0
votes
1answer
26 views

List does not return my manual field and how can I sort the list

I want to create a list of tasks, events, files and notes, so the sales man have just one list for all activities. The list works, but I still have a few questions. I add to each list a manual field ...
0
votes
1answer
25 views

Variable does not exist: Name compilation Error

I am trying to create a new case once the rating of a Hotel is < 45% Here Hotel__c is the parent object and Customer_Reviews__c is child Object with MDR Even though there is a field called Name i ...
0
votes
2answers
38 views

How can I add different objects in one List?

I would like one list of different objects (Task, Event, Notes). In mycode I create a wrapper class for the different objects and I display the list on a visual force, but there are still 3 lists just ...
0
votes
1answer
14 views

Select every list elements using field checkbox, not only - on example 50

Does Salesforce make it possible to select every records in table using field checkbox for list? Becouse when we select this checkbox, scroll down and new elements appears, they will be unchecked. Is ...
0
votes
1answer
35 views

Display sObject List in Visualforce page

I want to create an overview of a list which contains content from different objects. I will try to add in this list the files, tasks, events, emails and notes. I would like to show this list on the ...
0
votes
1answer
30 views

Concatenate data of different objects in one list

I want to create an overview of a list which contains content from different objects. I will try to add in this list the files, tasks, events, emails and notes. If I query for each object a list, how ...
1
vote
1answer
60 views

Why can't I render list of related product in LWC

Problem : I have to display a list of products related to a package (which is related to an order), but I have 2 issues: Only one element of the list is displaying It's displaying the same element in ...
1
vote
1answer
61 views

Parse JSON Response - List of Objects

Disclaimer: I am new to JSON parsing in Salesforce, trying to up skill. I am trying to extract the picture links, lets say the 'large' to be able to add to a contact record on record creation; { &...
0
votes
1answer
46 views

Lookup Fields based on Sales Team Roles

Do you know if possible to identify those in specific team roles via a lookup on an object? Specifically, I would like to show what Team Role the user has that a record has been assigned to on a list ...
1
vote
1answer
39 views

Unexpected Token '<' Apex Trigger Error with AND Statement

I'm trying to write a trigger that unlocks order records after they are placed in an approval process. The Trigger pulls a list of all orders where the CreatedDate = TODAY and the ...
0
votes
1answer
43 views

Compare records with same field value from different Objects in apex?

I have two lists with having the same field in a different object. How to compare the list of name is present in my list if yes then its should be update else it should only create a new record not ...
0
votes
3answers
49 views

Merge multiple List from queries

I would like to merge multiple List into one but I am not sure on how to do it .. My code is the following: public with sharing class ApprovalDashboard { public ApprovalDashboard(){ } ...
0
votes
1answer
48 views

Can I output the data to a datatable in my case?

I have a datatable in which I want to display the data in a certain way, namely: I have an Exchange_Rate__c object that has certain currency rates as fields: USD__c, CAD__c, EUR__c, GBP__c, as well as ...
0
votes
1answer
33 views

how to loop through a list of lists of different objects?

Let's say I have several different lists of objects: typeA[] Alist = [ ... ]; typeB[] Blist = [ ... ]; typeC[] Clist = [ ... ]; And I want to perform the same operation on each list: for (List<...
0
votes
2answers
62 views

Can I create a list of sobjects in a for loop where the name of the list will be dynamic?

I want to create lists of sobject where sobject types will be input from a custom label or a custom metadata. Can I create a list of sobjects in a for loop where the name of the list will be dynamic? ...
0
votes
1answer
71 views

Upsert list<SObject> with external id

I want to upsert a list of generic sobject with the external id field. This list of generic sobject contains records from different sobjects, where the sobject type will be unknown and will be ...
-1
votes
3answers
84 views

How to compare lists using apex

I have Two List of object records. List<Account> accList1 = [Select id from Account limit 4]; List<Account> accList2 = [Select id from Account limit 3]; I have another List<Account> ...
0
votes
0answers
29 views

get values from ANY type Object [duplicate]

I'm having issues trying to extract values from object list, this is the flow: button gets clicked click calls a callout function get response from response.getBody() at this point, I have two ...
1
vote
2answers
56 views

Is SubscriberKey the only field you can query from a MobileConnect list?

I need to query a MobileConnect List to delete some Contact records. I created a MobileConnect List and then used automation studio to query it into a DE. This worked fine BUT is SubscriberKey the ...
1
vote
1answer
32 views

Parsing map to get list of objects based on Key

Is there an easy way to extract the list of objects from a map containing list of objects? For ex, below is an example map that I need to deal with. map<Id, List<Contact>> ...
0
votes
2answers
49 views

Querying for users in a a Role based on Role Id instead of RoleName or DeveloperName

List<User> usrlst = [SELECT Id FROM User WHERE UserRole.DeveloperName LIKE : '%Customer_Support_Representative%' and IsActive = True]; The problem with this is that we changed the name of the ...

1
2 3 4 5
16