The Stack Overflow podcast is back! Listen to an interview with our new CEO.

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
1answer
33 views

How to populate a map with inner class variables?

I am trying to reuse a map in my code which is originally populated by a query for account. I am creating another query, which results should also populate the same map. Not sure if that is possible. ...
0
votes
1answer
21 views

Putting values in the Map

I am trying to put some values in the Map for learning purpose but getting some error , i am not sure i am following the correct way or not . public static Map<String,String> monthMap=new ...
0
votes
2answers
42 views

How to iterate over Map with same key, but different values?

I have this map: for(Opportunity opp: [Select Id, AccountId From Opportunity Where Id IN :SetIds]){ mapAcctOpp.put(opp.AccountId, opp.Id); } When I try to iterate over this map like this: ...
0
votes
0answers
34 views

First item in Map returning null when getting key value while iterating through List

I'm building a List<String> with the column header row from a CSV file to iterate through and get the API value from a Map<String,String> that is built from custom metadata. The issue I'm ...
0
votes
1answer
13 views

Adding values to map in apex inside for each

Map<string,string> salesPerCloser {get; set;} AggregateResult[] closerResults = [SELECT Count(Id), Closer__c from opportunity where ReportRegion__c = 'Brasil' AND CreatedDate =LAST_N_DAYS:7 ...
-1
votes
1answer
63 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
2answers
33 views

How can I assert that a map has the values needed?

if anyone could help; I'd appreciate some guidance on a test class I am working on. I am new to Apex and I am trying to test a class that uses a map which is the only piece of code I need testing for. ...
-1
votes
1answer
34 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
2answers
54 views

Is It A Best Practice To Pass Empty Map Purposely?

Here's the scenario: I've two different classes (say ClassA and ClassB) which will be calling a Static method (say meth1) of ClassC. meth1 has three arguments: List<String> lstStr, Boolean ...
1
vote
1answer
49 views

After Update Trigger and wrong values

I have a Trigger and Trigger Helper. Opportunity is a parent for CompanyOrder__c. One Opportunity can have many CompanyOrder__c records with uncrossed Start- and End Dates. CompanyOrder__c is a ...
1
vote
2answers
29 views

count the ocurances of a value in a list at js controller lightning

Below is my list, and i would like to count the string and keep it in map count==>["Vendor Master","Vendor Master","Customer Master","Customer Master","Customer Master","Customer Master","Material ...
0
votes
1answer
27 views

Reference field in a map of sObjects

I have a map that I need to reference the create date of an sObject that is part of a map. The map is: global Map<String,List<wbsendit__Campaign_Activity__c>> ...
0
votes
1answer
33 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
31 views

How to use field from map query

for (Id sourceObjectId : sObjectsFromDbCloned.keySet()) { SObject sObjectFromDbCloned = sObjectsFromDbCloned.get(sourceObjectId); if (sObjectFromDbCloned.Id != null) { clonedIds.put(...
0
votes
1answer
37 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
1answer
33 views

how to bulk check for opportunity in apex trigger

I have a requirement where I am checking on account trigger (on account update) if any opportunity is having Closed Lost status then changing account description with count of closed lost opp I have ...
0
votes
1answer
36 views

My wrapperlist is not showing up

I trying to create a table to provide metrics on the number of Account and Contact records grouped by state. So each state will have two number of count id. Below is a code for my class and visual ...
0
votes
1answer
41 views

Trying to update records by scheduling an apex class. However, I'm getting CPU Timeout Error with the code below. Am I suppose to use maps?

List<Deal__c> records = [ SELECT Name FROM Deal__c WHERE CloseDate__c < TODAY AND RecordType.Name = 'Franchise' AND (StageName__c != 'Servicing' OR StageName__c != 'Closed Lost') ]...
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
51 views

Compare map value and set<string> and retain string that doesn't exist in set

I'm iterating over below map. I want to compare map values and set and iterate over the map.values that doesn't exist in set Set<String> articleIds = new Set<String>(); List<...
1
vote
1answer
35 views

first key of map is dissapeared

CSV File contains headers. Full Name - is first column header, Manager Email - last column header. after file input, i create map that contains rowIndex (for VF apex:repeat), 'Header'='Value' (Map) ...
1
vote
3answers
71 views

Quickest way to get a Map<Name, Id> from SOQL ? i.e. Required field to go before object id

Need this map to populate the lookup field on a child object, finding id of lookup object by it's Name. e.g. [SELECT Name, Id FROM Account] --> Map<Name, Id>
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
31 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 ...
-1
votes
1answer
30 views

Unable to access values from the old map

Currently, I'm trying to get values from an old map because currently, my map is like Map <Id, Sobject> It's showing an error like Variable does not exist: ARPU__C I'm unable to fetch data ...
0
votes
1answer
34 views

Is Filling a Map iterating on a list, deepcloning it and clearing a best practise?

I'm trying to fill a Map < Id, List< sObject>> by looping other the Map.keySet(), filling the list of sObjects, affecting it, and then go to the next key. I read somewhere that it was a good ...
1
vote
0answers
29 views

Aura component with google map

I'm trying to create an aura component with an embedded google map (the new lightning: map thing) that would show all of our accounts on the map. I have two problems: The height of the component is ...
0
votes
1answer
36 views

How can I map two queries from junction objects into an instance of a custom object class that I need to return?

I need my getUser method to return an instance of the custom object class UserCTI. I need make two queries and map their results into the UserCTI object, or I can make a subquery within the primary ...
0
votes
1answer
23 views

How do I map set<DateTime> to List<Wrapper>?

I have created a wrapper class for example: List<wrapper> wrapperList = new List<wrapper>(); set<Id> ids1 = new set<Id>(); public class wrapper{ String abc; String ...
1
vote
1answer
25 views

Don't understand my Map behavior when doing Map.get(key).add(el)

I got a behavior I don't understand, I'm instanciating a map with this method : Map> createMap2 (Integer nbAcc) Public static Map<Integer, List<Account>> createMap2 (Integer nbAcc) { ...
0
votes
1answer
21 views

Cannont set property 'Name' of null map

I want to fill a Map the name as key and value as value of each input cmp <aura:attribute name="mapDataCible" type="Map" access="global"/> Js //i get all input const myInput = ...
-3
votes
2answers
53 views

How to create a map without duplicate values from a map that contains duplicate values? [closed]

I have a Map which contains the following entries: <1, Developer> <2, Admin> <3, Manager> <4, Admin> <5, Developer> <6, Sales> I need a new Map which shouldn't have the repeating ...
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 ...
0
votes
1answer
15 views

How do I set the size of an image from a map in visualforce

I have an image being showed in a visualforce page. How do I set the height and width in this case? I tried width="200px" but I cant use this attribute. See: <cxsrec:hasMapEntry map="{!...
0
votes
1answer
27 views

Invalid type when creating a map of <string, list<innerclassobject>>

Invalid type: EcPerformanceRecordList I want to create a Map of userid and list of sObject records, then loop through this map so that I can count how many apps have been submitted per user....
1
vote
2answers
20 views

How to use rendercondition visualforce on map

I have a map from which i get the value in visualforce. How do I use the redner condition to check that if the falue is empty it will not render. I get the error: Incorrect parameter type for ...
0
votes
1answer
24 views

How to nest a map to get a related structure

I want to display a relation Account>property__c>Booking__c>Order>OrderItem in a visualforce page. I want to nest the objects to represent these as parent>grandchildren> grand grandchildren>etc. I am ...
0
votes
1answer
61 views

How to nest maps and display them in visualforce page

I need to display a a 4 level deep relation on a visualforce page from the parent showing the child relations. Account>property__c>Booking__c>Order>OrderItem. Since we can only go 1 level deep with ...
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
113 views

How to check if a field value contains a value from map

I have a map that is populated with list, and also list collection from task object. How do update the task that is retrieved from the query based on certain conditions? Map<String, List<String&...
0
votes
2answers
35 views

map is adding the previous values also

My VF Page <apex:inputFile id="atchmntA" value="{!contentFile}" filename="{!nameFile}" title="Please select the CSV file to upload" onchange="verifyAttachmentSize(this)"/> <apex:...
1
vote
2answers
44 views

Get List of JSON objects in Map

I am passing List attribute as a String to aura action by JSON.stringify and this is what I am getting in the apex debug -- [{"minorDependent":"0032200000ADltqAAD","enrolledbyAdult":"...
2
votes
1answer
63 views

How to add an aggregate result from a SOQL query inside a map? Shows error- Unexpected token '['

I am trying to create a map of Opportunity ids and a count of its Opportunity Line Items. Map<Id,Integer> opptyIdLineCount = new Map<Id, Integer>(); AggregateResult[] aggOpptyIdLineCount =...
0
votes
1answer
53 views

Get data from multi level json string

I am getting some data in response to my code which is a JSON string as: HTTPResponse res = {"id":2048,"extension_attributes":{"stock_item":{"stock_id":1}}} Now to retrieve data, I've done Map<...
1
vote
1answer
43 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
0answers
10 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
49 views

How Get ID of the record from Map

I want to add Map id into Method Parameter And required only one I'd not Set Map<Id,fsCore__Transaction_Parameter_Field__c> obj =new Map<Id,fsCore__Transaction_Parameter_Field__c> ([...
0
votes
1answer
93 views

VF Page Error Incorrect parameter type for subscript. Expected Number, received Text [closed]

I'm getting below error when I'm trying to pass values from map to pageblocktable in Visualforce page. ERROR : Incorrect parameter type for subscript. Expected Number, received Text VF PAGE : &...
-2
votes
1answer
36 views

Is it possible to do a “reverse regex” pattern match?

I have the following code: if(PATTERN_A.matcher(someValue).matches()){ model = MODEL_A; } else if(PATTERN_B.matcher(someValue).matches()){ model = MODEL_B; } else if(PATTERN_C.matcher(...
4
votes
1answer
88 views

Can you output map values in visualforce inline using a string key?

Can you output a value from a map in a custom extension without or it being in a table? Tried the below and did not work. example extension: public without sharing class Example { public List<...