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
1
vote
0answers
26 views

Can't save map from Lightning Component back to apex

I'm truly stumped by this one. I have a map of ContentVersion docs. The keys are: "Mine" and "Yours" Depending on who is logged in, you can edit field values in the datatable that has "Mine" in it, ...
1
vote
1answer
16 views

Is it possible to remove of filter keysets by a standard method and only maintain keyset which start with a string

I query over Custom metadata to get 1 record(settings) with custom fields "MdtFieldsAcc" I pass the fields in a map with .getPopulatedFieldsAsMap() and then currently remove 1 keyset (Id). Is there a ...
0
votes
1answer
60 views

Getting null pointer exception on populating map of map data

I am writing trigger to update an order line item of order related to an Account when an invoice line item is inserted corresponding to that order line item. Problem is whenever a loop is iterating ...
0
votes
1answer
26 views

reason: Apex CPU time limit exceeded (refine the codes)

Im struggling to fix this CPU time problem, I have tried to refine my code as good as possible by implementing maps and as can be seen below; public class dailyUpdates2{ /// used for converting ...
0
votes
1answer
25 views

How do I check if a list-value from my Map is empty?

I get this error in case if Opportunity__c has no OpportunityInfo__c. I try to check it with the condition if(opportunitiesMap.get(actualTool.Rent__r.Opportunity__c).OpportunityInfo__r != null), but ...
0
votes
2answers
27 views

How and where can i use map along with list/set collection to get unique output

When I enter united states I need only one language. If I selected wrong language it want to throw an error. Map<String,String> countryMap = new Map<String,String>(); ...
2
votes
1answer
49 views

Placing an array into a Map

I'm placing data from the order sObject into a map and would like to be able to take the data from the orderItem sObject and add it to the end of my map so it can all be sent over in a JSON format. Is ...
0
votes
1answer
28 views

Lightning Maps Not Working in Communities - [Solved]!

The following problem persists when loading a lightning:map in a community page: Refused to frame 'https://maps.a.forceusercontent.com/' because it violates the following Content Security Policy ...
0
votes
1answer
31 views

how to understand JSON.stringify value?

Lets say, I have a map created in aura component controller. I want to send map to apex controler but unfortunately map cannot be serialized by JSON.stringify. My code JSON.stringify([...draftValues....
0
votes
3answers
43 views

Method does not exist or incorrect signature: void add(Object) from the type Set<String>

I am trying to populate this Set (buildingIds) with string values, but I am getting the error: Method does not exist or incorrect signature: void add(Object) from the type Set. I am returning some ...
1
vote
1answer
22 views

Inserting dependent objects without using a loop

I have this issue. I have a list of Contracts and I need to create Cases and custom objects called 'Budget' that the Case needs to lookup. The code can be summarized to something like this for(...
0
votes
1answer
64 views

Mapping two Lists/Sets

I am trying to get my head around mapping two sets (or if this is even the right approach). The objective is to take the name of a custom object (which is currently an email address) and map it to a ...
0
votes
1answer
35 views

How to avoid multiple soql queries?

I am working on something that requires insert, update and delete actions on Account object. I have written the below code but would like to know if there's a better way to do this by using maps ...
0
votes
3answers
75 views

Update map.values() doesn't work

I don't know why my object's field from map doesn't change. Can you help me please? public void changeCommentAfterUpdate(List<OppDesc__c> newOppDesc){ Map<Id, Tool__c> mapToConnect = ...
0
votes
1answer
33 views

Values in map overwritten by new ones

I have a Map where I put a String and a Decimal. Both of these fields are updated based on the day of the week. The String field can be converted into a date field since it's populated by the day, ...
0
votes
0answers
48 views

Fix the logic for proper comparison using a Map

I'm trying to check and change the Client__c value in Mopping__c if the In_date__c has changed in the needed Rent__c. There is a lot of data, therefore Map is used. Structure: if Mopping 1 is related ...
0
votes
1answer
21 views

Invalid type for Map

I have a Map inside a Map where I want to put values of type String (TechDayMonthYear_2__c) and Decimal (AttendanceRate_2__c). But I get 2 errors "Invalid type: tp.AttendanceRate_2__c" and "Invalid ...
0
votes
1answer
15 views

How to get a List Element of a Map

I have a map Map<Id, list<Boolean>> mapOfIdAndListBoolean = new Map<Id, list<Boolean>>(); I think I can get the whole list by using mapOfIdAndListBoolean .get(order.AccountId). ...
0
votes
1answer
26 views

Null Pointer Exception when trying to compare one field to update records

I have a requirement where I need to compare Child object records of one parent and update values based on that. Parent Record -> Contact Child Record 1 -> Driver (has lookup to contact) Child ...
0
votes
1answer
37 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
23 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
44 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
35 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
16 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
64 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
40 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
38 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
50 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
32 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
28 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
41 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
40 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
39 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
45 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
56 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
72 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
73 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
33 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
31 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
35 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
43 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
39 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
28 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
26 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 = ...