Questions tagged [map]

A map is a collection of key-value pairs where each unique key maps to a single value.

Filter by
Sorted by
Tagged with
-2
votes
1answer
24 views

How to pass a variable as the key for the Map.get method?

I know that to get the value of a map, i should use: String s = (String)Map.get('key'); The above code works fine. But, I want a variable to be passed as the key. I tried like this: String k = 'key'; ...
0
votes
1answer
14 views

Unable to see created date in the mapping while importing data for lead object using data loader

I am using a Sandbox account to load data into the Leads object from a CSV via the data loader. However, I am unable to see the created date, last modified date (Audit fields) in the mapping window. ...
0
votes
3answers
40 views

Comparing Two Lists of Different Objects

I have two lists for two different objects. They are both are related to opportunities. I want to check to see if the two lists are associated with the same opportunity and, if they are associated ...
0
votes
1answer
19 views

Loop must iterate over collection: Account

In the code below, I get compiler error on Loop must iterate over collection: Account Can anyone help me about this issues. list<Account> acc =[Select Id, (Select Id, Name from ChildAccounts) ...
0
votes
0answers
25 views

Trigger on Child Object Creation and Getting Parent/Related Records

I am attempting to create a trigger on a custom object called "abacus__Ledger_Entry__c" that is related to Opportunity. I then need to retrieve values from the trigger object or other ...
1
vote
1answer
22 views

How to pass map values on client side from component to controller

I currently have a child component to which I pass some map values from a parent component to an attribute in the child component on the client side. I used an example which gets map values from ...
0
votes
1answer
33 views

How to reproduce a dynamic selection list from a custom object in lightning component

I have a @AuraEnabled method from which I pass a custom object list to a lighting component on which I want to iterate. The custom object will have a dynamic map from which I want to create a dynamic ...
1
vote
1answer
35 views

Mocking Object list issue

This question is sort of a continuation to this question. I have this method: public static void sendMail(List<Object> selectedRows) { if (selectedRows.size() > 0) { for (...
0
votes
0answers
15 views

How can I compare elements from a SOQL in a for loop?

I need to compare contract[0] from the same Account with the contract[1], if they have same values as in the specific fields that I'm using in SOQL I don't need to add it on my map.So if contract[1] ...
0
votes
1answer
28 views

Accessing aggregate result map

I have the following code; List<Account> accs = [SELECT Id, TotalVisitbyCurrentOwner__c, OwnerSince__c, Owner.Id FROM Account WHERE AccountCountry__c = 'ID' AND (TypeOfCompany__c = 'Developer' ...
2
votes
1answer
36 views

How to serialize a string into a Blob value without backslashes?

I have a Map<string, String> that is populated using the following code below. When I attempt to convert this into a serialized string so that it can be passed into Blob.valueOf, the \" (...
0
votes
1answer
31 views

Apex Specialist Superbadge Step 4 - Cover Map line [duplicate]

I'm having trouble to get 100% coverage on that trigger, the line that is not getting covered is that: "casesToEvaluate.put(maintenance.Id, maintenance);" Here is my trigger: trigger ...
1
vote
1answer
204 views

Receiving error while iterating over a map in javascript in LWC - “e.map is not a function”

I am getting a different error and can not seem to figure it out now for a coupe of hours, Here's my code : createMapMarkers(boatData) { console.log('DATA :'+boatData); const newMarkers = boatData....
0
votes
1answer
13 views

How to get ID from Parent object when field value matches

I have a requirement to update Account_Transfer__c(Child) object with District Name(Parent) when a field value matches on child record. below is the logic that I've achieved so far insert ...
2
votes
2answers
76 views

Efficiently sorting a list of Work Order records by a Sequence

I have Work_Order_Sequence__c and UniqueKey__c field on Work Order object. In my method I wish to create a Map which has a Key => UniqueKey__c and Value=> List<WorkOrder> (sorted). ...
0
votes
2answers
41 views

Error: Id not specified in the update call

Below is my apex method where I'm updating Account_Transfer__c Records private static void linkPoliciesAndHandleApprovalFlds( List<string> selectedPoliciesSet, Account_Transfer__c ...
2
votes
1answer
64 views

Map changing the order of key value pairs in apex

I am creating a map from a string stored in a specific format. But Adding the key-value pairs and later displaying it, I notice the order is not maintained on the map. Is it possible to maintain the ...
0
votes
1answer
34 views

Map<ID, Set<String>> Loop Question

I have a Map<Id,Set<String>> In my code. I have a loop structured as this: for(value : data) { for(String string : Map.get(value) { //Do something } } When I do this ...
0
votes
2answers
36 views

Get all Sobject Label and API name in Ascending order according to the label

Is there any standerd methord to get all Sobjects name in Ascending order. I am able to get all objects label and API name by the following code. I need to put all the names into map in ascending ...
0
votes
1answer
23 views

Collection is Read Only - Map.Remove()

I am building some maps to compare which profiles have access to which fields. In doing this I need to compare the results of a FieldPermissions query against all available fields as there is not a ...
2
votes
1answer
41 views

How do efficiently store child and parent relation in a map retrieved from a nested SOQL?

I've got the following query: List<Order> orders = [SELECT Id, (SELECT Id, Type_Reference__c FROM Cases__r) FROM Order WHERE Id IN :orderIds]; and I need to store that information in the ...
1
vote
1answer
41 views

Loop Through a List of Maps

I am running into an issue where I want to update a student application from a returned JSON payload from a lwc. I am attempting to loop through the list I am attempting to loop through the map and ...
0
votes
1answer
27 views

Field calculations per Account and their total

I have a object called Business transactions which is related Account(Planner). I need to calculate the total of one field called commissions for each Account and show them in total. I'm able to ...
-2
votes
3answers
55 views

Understanding Map Of Map [closed]

Can some one kindly explain me the practical use case of Map<Id, Map<Id, Map<Id, String>>> as I am under confusion under what scenario we need to take such type of Map, kindly dont ...
1
vote
1answer
56 views

Google geocoder status is OVER_QUERY_LIMIT Lightning Map

I have an aura lightning component that uses Lightning:Map. When i have more than 10 addresses, i get the message Google geocoder status is OVER_QUERY_LIMIT. 1) Are there any limits on how many ...
0
votes
1answer
22 views

Setting Contact from Map.get() Returning Null - Debug Shows Contact

I have a Map that stores cases and existing contacts. I am populating the map and confirming so with debug logs. All of the debug logs show there is a returned Contact record when I use the .get ...
1
vote
1answer
33 views

Not able to load URL in featureLayer function using esri in Salesforce

Getting error while loading layer on leaflet map using esri in LWC. Error: Refused to connect to '' because it violates the following Content Security Policy directive: "connect-src 'self' *....
-1
votes
1answer
17 views

Variable does not exist in in method

I am trying to pass value from a map into a string set but get the error: variable does not exist: NewToolsMap in my execute method. I tried to make my map public but this does not seem to work. How ...
0
votes
1answer
22 views

Map values once pushed in are persisting between LWC template transitions

So I am facing this problem here,in short it goes like I have two templates which are conditionally displayed on click of Next and Previous so it is essentially lightning combo-box component with ...
0
votes
1answer
52 views

Cannot Display exact adress on the map (LWC)

I seem unable to display exact adress of an account shipping adress on a google map! import { LightningElement, api,track ,wire} from 'lwc'; import getRecentModifiedAccounts from "@salesforce/...
0
votes
0answers
34 views

Matching field in soql query

I have one scenario where when lead is created,I am updating lead object owner if text field 'agent id' on lead matches text field 'usr agent id' on user object.But there are few scenario's where ...
0
votes
1answer
43 views

Using Trigger.new List and Map compare new contracts with old contracts

I'm trying to compare dates of old contracts and new contracts (trigger.new) from the same account, the new contracts are imported and are from a lot of different accounts. But the performance of it ...
0
votes
1answer
28 views

Visualforce with Map in Map to get rate of login between current and last week

I'm trying to program a VF page to get the list of org's users and their logins this week versus last week, but I'm not able to deal with this "Map/Map" thing to do so. Can anyone help me deal with ...
0
votes
1answer
27 views

Dynamically checking the values of a wrapperClass for a validation

I have a wrapper class. public class wrapperClass{ String s; Date d; Integer i; Id id; } There are different operations for which certain fields are required on these wrapper object. Example 1. for ...
0
votes
0answers
43 views

create a new map from map<string,Map<String,String>> and map<string,Map<String,Object>> in apex?

I have a Map<string, Map<String, String>> map1 containing the object as the outer key and the value contains field api name and the label (the label is something which i want to use and ...
0
votes
3answers
47 views

how to pass subquery als list into map

I have a soql with a subquery. What is the easiest way to pass the id of the query and the list of the subquery into a map. Do I need to create a loop for the subquery and ad them first to the list? ...
0
votes
1answer
24 views

Public map value returns null after first batch iteration

I'm working on a CSV parser that I now want to handle the processing of more records. By doing so I'm porting my existing apex class to a batch class. I execute my batch with: Database....
1
vote
2answers
65 views

Any limit for map collection size for ReadOnly page

Context Since Lightning component Aura or LWC does not support @ReadOnly mode yet, we have opted for a Visualforce page to export queried data into an Excel and benefit from higher query rows limit. ...
1
vote
1answer
11 views

Display Leads and Accounts in the same visualforce <apex:map>

I have a apex class that queries for leads which I then display in a visualforce using apex:map to show where these leads are located. What I want to do now is to display also accounts in the same ...
0
votes
0answers
72 views

The value in the Map becomes null [duplicate]

I want to ask the question that why the value in the map becomes null. List<Order> insertOrderlist = new List<Order>(); Map<Order,Decimal> OrderPaymentMap = new Map<Order,Decimal&...
1
vote
1answer
20 views

Unable to access custom field in for loop from another class

I am getting "Variable does not exist:field" error when I am trying to refer to a field in For loop from a different class, below are my classes Class1: public static Map<String,sobject> ...
0
votes
0answers
19 views

How to change the values of a Map from Visualforce page?

I want to create a table that displays some time slots with a checkbox next to it. At the end of the table, there's a submit button. For the table, I used a Schedule__c object and also declared a Map, ...
0
votes
0answers
17 views

Create a list of accounts and access their fields

I am tackling a Salesforce APEX - problem which is probably quite straight forward but I can't figure it out: I have extend the code from https://developer.salesforce.com/docs/atlas.en-us.pages.meta/...
0
votes
1answer
19 views

Which element from Soql query gets stored in key part of MAP while fetching records from SOQL query directly in map

If i have a query like Map<Id,TER_Meter__c> mapIdToMeterPair=new Map<Id,TER_Meter__c>([Select Id,Name,(Select PAS_Customer_Consent_Flag_Effective_From__c,...
0
votes
1answer
44 views

Tips to generalize code in apex with Map<string, set<string>> and Map<string, set<SObject>> and how to call method of SObject

I am working on some generalization of my code and I'm struggling with some cases which are irritating me because I think I'm having code duplicity. 1) I'm often working with some map<string, set&...
0
votes
0answers
18 views

map.remove() isn't removing the records from a map [duplicate]

When I update a contact in Salesforce, I want to update the contact's related object's records (Contact Information object) address if it exists else insert a record. I am using the below code but ...
1
vote
1answer
27 views

Map Sort by Object field

I have the following code: @AuraEnabled public static Map<Id,Location__c> getAllStoresInRegion(string currRegion){ LocationService locationService = new LocationService(); Map<Id, ...
0
votes
1answer
25 views

Fetch OpportunityLIneItem along with OpportunityId in Map

Map<Id,List<OpportunityLineItem>> oliList=new Map<Id,List<OpportunityLineItem>>(); for(Opportunity opp:eligibleOpp) { if(opp.opportunitylineitems....
1
vote
3answers
76 views

Why can Map<Id,List<SObject>> be assigned to Map<Id,List<Account>>?

Assigning a sobject map to a specific sobject-type is not possible, i.e Map<Id,SObject> sobjectById = new Map<Id,SObject>(); sobjectById.put(a.Id,a); Map<Id,Account> accountById = (...
0
votes
1answer
39 views

How to clone trigger.newmap when passing into a trigger hanlder [closed]

I was wondering how to clone trigger.newmap or how to still have access to the references associated to it when I want to pass this into a trigger handler.

1
2 3 4 5
14