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
-1
votes
2answers
14 views

Why I am getting error : System.SObjectException: SObject row was retrieved via SOQL without querying the requested field?

Covered Product is an object and Installed product is a lookup field on Covered product and Status is a picklist field on Installed product. When I am trying to run the below code in Execute Anonymous ...
1
vote
1answer
28 views

apex : convert object to a list

I have an object with value (s1,s2,s3,s4) (this is the value i get during System.debug) now i want to convert this values to list of strings , i.e ['s1','s2','s3','s4']. how can i do that? i tried , ...
1
vote
1answer
23 views

Performing an update on record/s that appears in two lists. How to stop the update appearing in both lists (my own old and new lists)

I'm working on a class thats outside the normal trigger set up and used as part of an integration. I'm looking to have two list or maps, one that contains the records data pre update. The second ...
0
votes
2answers
35 views

Will acc.Contacts return list of all Contacts related to the Account?

Will acc.Contacts return all the related contacts to the Account? What does actually acc.Contacts means in this code? When I am doing System.debug() it returns (). What should be the output for this ...
-2
votes
1answer
23 views

convert list with duplicate id to Map

I am working on an apex which is used to clear Hierarchy field values on User records when a user is deactivated. I am stuck at the last part of code. I have a List with same UserID but with different ...
1
vote
1answer
29 views

How to select other Welcome Email in Marketing Cloud?

I created a new list for subscribers and want to set up a welcome email but when I try to choose emails, there is one basic test email appears. How can I select email which I created earlier from &...
0
votes
1answer
27 views

I have 1 list and want to use 1 list and create a new list with the data

list<Contact> listOfContact = new List<Contact>(); for (Contact conObj : listCon) { if (String.isBlank(conObj.accountid)) {...
-2
votes
1answer
31 views

Parse JSON and loop through

This is my raw return [ { "orderDetails": { "orderId": 12345, "caseName": "Smith vs Smith", "orderStatus": "Active Case&...
0
votes
1answer
88 views

List value not recognised in SOQL?

new to apex & LWC and have come unstuck at what i think should be working....this controller supports a lightning component and is not throwing an errors but is not returning the expected data........
-2
votes
2answers
48 views

because you can't populate a map with lists of lists

trying to populate a map with a list list like this: map<integer , listlist<<sobject>>> mpsosl=[find ' ba' IN all Fields RETURNING contact(name)]; error:Illegal assignment from List&...
0
votes
0answers
44 views

List has no rows of assignment to Sobject

I am facing an issue with the below code my List has 200 records but still i am facing this error List has no rows of assignment to Sobject. Could someone please help with the below error on why i am ...
0
votes
1answer
35 views

Queueable insert list records from map and keep order

I have Map with Account and Account Id. I want to insert that accounts in Queueable and return list of all ids in order as acount is inserted(Or map, it doesnt really matther). How can i keep order if ...
1
vote
1answer
26 views

Get element from list which contains element from another list

I have two Lists with diffeerent lenghts and want to check this value. It must be something list that: List<String> first = new List<String>{'Test','Something'}; List<String> second =...
3
votes
1answer
125 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
56 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
33 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
60 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
42 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
19 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
27 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
23 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
19 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
37 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
41 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 = [...
-3
votes
1answer
94 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 ...
1
vote
1answer
20 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
30 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
69 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
53 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
54 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
90 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
72 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....
1
vote
1answer
23 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
265 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
54 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
53 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
46 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
31 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
27 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
42 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
16 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
49 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
42 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
122 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
141 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; { &...

1
2 3 4 5
16