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
0 votes
1 answer
38 views

when does the Map return null?

class MapTask { public static void main(String[] args) { Map<KeyClass, Object> map = new HashMap<>(); KeyClass key = new KeyClass(); Object value = new ...
Vlad's user avatar
  • 1
0 votes
1 answer
38 views

Get field value from within a Map

I have a Map that is returned from apex to my LWC. Below is the apex: public static Map<string, opportunity> existingOppCheck(id accountId, id brokerId, date effDate, id ownerId, List<...
Frank's user avatar
  • 411
-2 votes
1 answer
36 views

Cannot pull mapped value after the record is inserted

This is an apex action used in a flow. I have the issue when the flow takes in multiple requests, but works fine for individual requests. I am trying to write the code in a way it can handle multiple ...
sumchans's user avatar
  • 767
0 votes
0 answers
49 views

Show URL in the title of LWC lightning-map

The image from my Lightning web component That's what I want to achieve I am implementing lightning-map for one of my clients. I actually need to show the URL or a button that would open google map ...
Areeba Irfan Ullah Khan's user avatar
0 votes
0 answers
69 views

How to store large amount of data in a variable for a batch bypassing heap size exception

I am stuck with the following error: 'Batchable instance is too big: ProductDiscountsFormatterBatch' I have a junction object called Account_Product_Discounts__c with the information of, for each ...
Arnau LS's user avatar
0 votes
1 answer
42 views

there must be only one primary contact on account by utilising isprimary checkbox

stuck in here What if someone uses dataloader and make 2 contacts for same account as primary, then my code is not working public class Contactispr { public static void Conta(List<Contact> ...
manutomar46's user avatar
-1 votes
2 answers
72 views

System NullPointerException on get from map

I have a nullpointer exception in the following code on line if(mapSoldAppStatus.containsKey(user.Id)){: Map<String,Map<String,Integer>> mapSoldAppStatus = ReportPageController....
Thomas's user avatar
  • 2,294
0 votes
1 answer
38 views

Test class for batch with another class called in it: Batch has 100%, but called class only 24% coverage [duplicate]

Batch class: public class BatchClassForCustomer implements Database.Batchable<sObject>{ public Database.QueryLocator start(Database.BatchableContext bc){ string query='...
Pratik Bokade's user avatar
0 votes
0 answers
42 views

How to avoid writing nested for loop [duplicate]

I'm new to Map concept and ending up writing queries in for loop causing APEX violations. I have a list of Ids on which I loop over and call a method. To this method I'm passing the Id and another ...
sfdcTod's user avatar
0 votes
1 answer
187 views

Map value to specific variable in loop within Flows?

Working on a flow in which I need to iterate over up to 12 records and sort it in descending order by date. Then take a single value from each record and store it. I will then update the parent record ...
stormy's user avatar
  • 37
-4 votes
1 answer
71 views

How to retrieve multiple Ids from a map

I have a List<String> which will return some records as below. List<String> ids = ['abcdef','xyzabc','lmnopq']; List<Object2> obj2List = [SELECT id, field1__c, field2__c where ...
sfdcTod's user avatar
9 votes
1 answer
348 views

Map with object as key behaves weirdly

consider the following code : Map<Object, Object> m = new Map<Object, Object>(); String s = 's'; m.put(IAccounts.class, s); // any type here does the trick System.debug(m.containskey(...
Julien Gaïotto's user avatar
1 vote
1 answer
183 views

LWC extract values from Apex Map<String,List<Sobject>>

In my LWC I am using an Apex Class to return a Map<String,List> containing lists for Leads and Contacts. I want to iterate this Map and use the individual lists in separate datatables. I have ...
Jeff Callahan's user avatar
0 votes
0 answers
34 views

How does typecasting SOQL records to Map<Id, SObjects> maintains the order? [duplicate]

As we know we can typecaste SOQL results to a List, or Map. List we all know is Ordered thus, can maintain the order. Map we know its always unordered because the keys of a map is Set So if I do ...
Nagendra Singh's user avatar
0 votes
1 answer
52 views

.get method not returning value even though I copy/pasted the key into it

I'm creating a map based on a custom object in my org. Basically this is the code for it. Map<String, String> translationMap = new Map<String, String>(); List<StageNameTranslation__c>...
potato46's user avatar
-1 votes
1 answer
52 views

LWC map overflow with many markers

I added a map to the LWC component, but once I add many markers points it overflows and the page will be too long. Any ideas?
Hussein Gabr's user avatar
0 votes
0 answers
31 views

Is there a way to create a Map that contains the parentId and the list of its history records? [duplicate]

I have a custom object and it's history is shown in UI. I am tracking the certain field. However, I have a problem putting the parentId and list of its history records into the map. Custom object : ...
user11880836's user avatar
0 votes
1 answer
64 views

Sort Map results

I have a map which I want to sort the results in ASC order Let's say that yearToDate is holding the below result The result I have in yearToDate is yearToDate::{Year 1=2023-09-15 00:00:00, Year 2=2024-...
KSL's user avatar
  • 512
1 vote
1 answer
2k views

How do you display a js map in LWC

I have a customer apex controller that products a payload with an json apex map of map<String, List>. once i execute the apex method the javascript i convert it with json.parse and load them on ...
Cancel Ed's user avatar
0 votes
2 answers
62 views

Creating a map/list from a sorted SOQL query

This is my list and map List<Account> accountList = [SELECT ID, Name, Var__c, foo__c FROM Account ORDER BY Foo__c ASC]; Map<String, String> testMap = new Map<String, String>(); for(...
user137988's user avatar
0 votes
1 answer
58 views

Different count of account records when using Map

I am working on a CSV data upload via email to apex where if the account record exists i need to get the Id and perform an upsert operation. I am using Map to capture all the accounts and checking if ...
coderdecoder's user avatar
0 votes
1 answer
73 views

How to sum the values of an aggregated query

I have a parent object Account with related contacts these related contacts have (several) related statuses i.e. A B C. These are all the statuses a contact has had. On the parent Account I need to ...
Thomas's user avatar
  • 2,294
0 votes
1 answer
365 views

How to iterate over map with id and Sobject list

I have the following piece of code: map<id,List<Spot__c>> spotMap = new map<id,List<Spot__c>>(); List<application__c> apPList = [SELECT ID, Account__r.id,(SELECT id,...
Thomas's user avatar
  • 2,294
0 votes
1 answer
92 views

How to get variable access scope which is set from result of an imperative apex call in another block?

I have a method in which I am making an imperative apex call which returns the result in the form of a Map<String, Boolean>, this again I am converting to a map (I need it in map form as in ...
Amax1's user avatar
  • 109
3 votes
2 answers
552 views

What is the maximum length for a key in a map in Apex?

Is there a limit to the maximum key size for a map in Apex? Say if I have Map<String, SObject>, how long can the string key be?
Arthlete's user avatar
  • 4,907
-3 votes
1 answer
167 views

How change this nested for loop to map

I took this code from another question asked in this site My code is similar to the below. Please say how to change the nested for loop used in this snippet to map. trigger OpportunityTrigger on ...
Sushil's user avatar
  • 3
0 votes
2 answers
89 views

update fields in a records which is coming as a string

I am getting fields and its values in form of a string, for example: field1*Value1,Field2*Value2,Field3*Value3 I need to update above 3 fields in a record with their given values. Object ob=new object(...
Learner's user avatar
  • 21
1 vote
1 answer
298 views

Unable to retrieve value from a map even though the key is correct

I have a map and have pushed a value into it, but when using get map, the result returns null. After debugging, I found that the key is correct. What could be the reason? Can someone help me? This is ...
Nguyễn Mạnh's user avatar
0 votes
1 answer
101 views

Map markers not displaying for other Salesforce users

I have been working on a project where it will display 9 of the most recent "Signed" or "Rev Rec'd" Opportunities. It completely working correctly for me, but for some reason its ...
Pinto's user avatar
  • 128
0 votes
1 answer
42 views

Can I switch between mapIcons using a if-statement?

I want to be able to switch between different map icon colors depending on the StageName. For example I want the StageName "Rev Rec'd" to be blue, and "Signed" and "Signed LOI&...
Pinto's user avatar
  • 128
0 votes
0 answers
34 views

Map<sObject, List<sObject>> values not showing on VF page in salesforce

this is controller public class AccountContactController { public Map<Account, List<Contact>> accountContactMap { get; set; } public AccountContactController() { ...
Mohsin Shaikh's user avatar
1 vote
1 answer
148 views

to get id in the place of index number in for loop

I have a method on which I'm running loop for showing all records of particular user(account). I'm getting index number in result. I want to show id of user instead of index number. public static ...
Abhishek Sharma's user avatar
0 votes
0 answers
280 views

Help with building nested map

I have a need to setup a structure in apex where I can specify for a Contact object and a specific set of record types, a set of fields have xyz custom roles. For example: I want to define a structure ...
Degmo Befada's user avatar
1 vote
1 answer
640 views

Process map of objects from LWC in Apex controller

I'm creating new records in my LWC and have a map to allow for updating values before doing the save and I finally got the LWC to communicate with the controller, but the values sent seem to be empty, ...
Irene's user avatar
  • 1,769
0 votes
1 answer
2k views

How to check if a http response is null when it is an empty object and status code is 200?

Im making a POST to an endpoint and this is what I get back in my response, its a successful POST and the status is 200 but the payload is empty. { "payload":[], "datetimestamp"...
potato46's user avatar
1 vote
1 answer
173 views

Passing Javascript map from aura controller to Apex Controller - Not working

I'm passing below Javascript map from aura component controller to apex controller but map is showing empty in debug log. var obj = {'0QL8W000006RHl1WAG'=>1,'0QL8W000006RHl0WAG'=>2,'...
Pravindra Singh's user avatar
1 vote
2 answers
1k views

Convert array of objects to an object in javascript

I have an array of objects with below value var arr = [{"Id":"0QL8W000006RHl1WAG","Sortorder":"1"}, {"Id":"0QL8W000006RHl0WAG",&...
Pravindra Singh's user avatar
0 votes
1 answer
1k views

Deserialize Very Specific JSON into Map <String, Object>

I have searched internet for hours and can't find how to convert my specific JSON: [{"_id":"55d66226726b611100aaf741","replacement":false,"quantity":5,"...
ApexNoob's user avatar
0 votes
1 answer
41 views

Having issues with handling text field

I have one requirement where text field have information like below format: String name = 'email,phone(Jason),mobile,address(Mason)'; Now what I want to do is create a Map<Key, List<String>&...
Sam Rickert's user avatar
0 votes
1 answer
229 views

Using Map To Convert Value - How To Access Value From This Map And Avoid SOQL In Loop At The Same Time

I'm building an Import feature (any Object can use this) with Flows and Apex action. When user upload a file via Flows, Apex action will go through all row and return output. After done checking and ...
Pam's user avatar
  • 107
1 vote
2 answers
584 views

How to reference field from an AggregateResult Map?

I am receiving an error when trying to reference the field alias CaseCount__c in my map. It says "Variable does not exist: CaseCount__c". How can I reference this field value? List<...
Alan's user avatar
  • 27
0 votes
1 answer
567 views

How to set values of map in lightning component

I am adding values to a map. I checked if values are filled still when i try to get the values from the map by key I get: undefined in de console.log Controller const mapAcc = new Map(); var accId =...
Thomas's user avatar
  • 2,294
0 votes
2 answers
70 views

Can this nested loop be done through a map?

I have the following bit of code which is a nested loop that I'd like to know if it can be replicated by using a map instead as I haven't used them before and would like to know how it would end up ...
qnt13's user avatar
  • 3
1 vote
0 answers
108 views

Map<Id, List<String>> or Map<Id, List<SObject>>, how access values?

I need to have a Map<Id, List<String>> or a Map<Id, List<Custom_Object__c>> to store this data: Id = Id of the record that is above, List<String>/List<Custom_Object__c&...
Alexia's user avatar
  • 81
-3 votes
1 answer
128 views

Display Object record information in visualforce page [closed]

I have a map UserTest <Id, List<String>> which displays the User ID and related permission sets assigned to each of the users in the Visualforce page. I need to also display other ...
sourav guha's user avatar
1 vote
1 answer
45 views

Visualforce Map Render if Keys Match

In my Visualforce Extension Controller I have 2 Maps using the same Keys Company - Map <Integer, List> Role - Map <Integer, List> In my VF Page I would like the output to be grouped by ...
Jeff Callahan's user avatar
0 votes
1 answer
384 views

How can I use map.keySet() and map.values() in one SOQL?

I have a map like this: Map<ID,List<ID>> invs = new Map<ID,List<ID>>();. I am trying to delete like this: delete [SELECT ID FROM Invoice__Share WHERE ParentId IN :invs.keySet() ...
TomaszOleszko's user avatar
-2 votes
1 answer
351 views

How to do bulk updates using a map?

This is a contact trigger handler updating the account. The aim is getting the most common email domain and rolling that up from the contacts to the account. I'm doing this by looping through the ...
NJW's user avatar
  • 3
0 votes
1 answer
448 views

How to display map key/value in a table in a lightning component

Slowly getting there but related to Pulling JSON Data from API to Lightning Component. I've been able to return the data in a map as, the key/value populate correctly judging by the console log. End ...
n34_panda's user avatar
  • 617
-1 votes
1 answer
2k views

How to convert Map<String,List<String>> to Map<String,String>?

I have a Map<String,List> and I want to convert to Map<String,String> converting list to string.join(','). I tried this, but it only replicates one value User u = new User(); List<User&...
Alexia's user avatar
  • 81

1
2 3 4 5
19