Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [map]

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

4
votes
1answer
57 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<...
1
vote
3answers
42 views

Why Map in Apex is auto sort key?

I have code below public class LearnAboutMap { public LearnAboutMap () { Map<String, String> m = new Map<String, String>(); m.put('Type', '1'); m.put('...
0
votes
1answer
30 views

How to create an efficient helper method that return an object given a map of field-values?

One of the most tedious task when writing test class is to create test data with no particular requisites. The idea is to have a helper method that is able to return the object given a map of field-...
1
vote
0answers
46 views

how to avoid system.limitexception too many soql queries 101 in apex classes [closed]

when I am trying to deploy the component then I was getting this error like system.limitexception too many soql queries 101 how to avoid this? ====================================== /** * @...
1
vote
0answers
33 views

how to avoid system.limitexception too many soql queries 101 in apex class [duplicate]

when I am trying to deploy the component then I was getting this error like system.limitexception too many soql queries 101,how to avoid this please help me any one,thanks adavance. I am getting error ...
2
votes
1answer
28 views

Binding Javascript map to Aura Attribute map

A similar question was asked here but unfortunately not appropriately answered. I have my aura map declared as follows <aura:attribute name="productInfoMap" type="Map" default="{}" in my ...
0
votes
1answer
24 views

Overwrite a related list for an sObject inside a Map without looping?

Question: Salesforce allows me to write specific field values to specific related list records on an object in a Map by referencing the __r[Index] relationship of that particular record. However, it ...
1
vote
1answer
60 views

Do Maps have an Reliable Relationship between keySet() order and values() order?

Let's say I have a map, for example: Map<SObjectField, SObjectField> valueByKeyMap Assuming neither the Map nor its contents are mutated by other activity in the system, can I rely on these ...
0
votes
2answers
44 views

Is it possible to create a generic Map swapper?

I have a method: public Map<Object, Object> swap(Map<Object, Object> valueByKeyMap) { Map<Object, Object> keyByValueMap = new Map<Object, Object>(); for (Object key : ...
1
vote
2answers
198 views

Is it possible to convert Map<Object, List<Object>> to Map<Id, List<SomeConcreteSObject>> without a loop?

As a Salesforce developer, I am frequently working with Maps and am looking to abstract the process of generating maps from SObject lists. I've created the following helper class: private class ...
-2
votes
1answer
30 views

How to create a Map with generics Id and String?

How to create a Map<Id, String>([SELECT Id, Name from Account]);? The query returns Map<Id, Account>. I want to get a Map<Id, String> without using loops and without having to ...
-2
votes
1answer
45 views

how to aviod soql query in the loop , i have to get get child data in my method

I have 2 object object1 and object 2(related object) ,,,i wrote trigger on object1 when object 1 record gets created user record should get created.. i stored profile perssion set information in ...
0
votes
1answer
28 views

Invalid conversion from runtime type List<ANY> to a wrapper class

I have a Map like this: Map<String, Object> seeMap = (Map<String, Object>) instance; system.assert(seeMap.get('fish') != null, true); // this assert passes System.debug(seeMap.get('fish'))...
0
votes
1answer
24 views

Putting a List Inside the value of a map

I am getting an error Error is in expression '{!setGroupBy}' in page customjobapppage: I tried multiple approach and I ended up with this: so this is how i Initialize my map public Map<...
0
votes
0answers
15 views

Unit test for a update list Apex Class [duplicate]

i need to write the Unit test for my class in apex, but i don't understand how to function a Unit test, i read many articles for unit test but i don't understand how to work, my class is this, please ...
5
votes
1answer
47 views

Map values not recognized as an SObject list for DML

One of my fellow developers was working on a class that converted feedback from a REST callout into SObjects. Part of the class was storing the feedback in a map, and then attempted to upsert the map ...
1
vote
1answer
16 views

Get value from deserialised JSON

I have a JSON string which looks like this: jsonstring = {"XX":["Blah blah"]} I need to get the 'Blah blah' into a string variable. How do I do this? Tried doing it this way, but all that returned ...
0
votes
1answer
39 views

How to get value from object Json.deserialize

I have deserialized a JSON object as follows: MyObjects MyA = (MyObjects) JSON.deserialize(req.requestBody.toString(),MyObjects.class); When I do MyA.get('Accounts') my result is as follows ({...
0
votes
1answer
20 views

Apex:Repeat within an Apex:Repeat

Alright guys, I have what I feel like is a simple problem. I want to show a map within a related map. I have written a controller and page to do that but for some reason the submap doesn't repeat. I ...
1
vote
1answer
52 views

How do I populate a Lightning:combobox with content from a map?

I've generated a map in my apex controller which I would like to use to populate a combobox. Simplified code below: Component: <aura:component controller="myController" implements="force:...
1
vote
2answers
18 views

Not able to put master record id as key in Map getting null

I am trying to build a map Map<ID,Post_Chat_Reponse__c> Where ID is master record id and Post_Chat_Reponse__c is details object. Here is my code Getting null for ID No idea why is this ...
0
votes
1answer
40 views

How to check in a map if specific value exist under multiple keys in Apex Map?

I have a Map of Permission set and the business Unit like below, the map is being generated from a custom setting Map<string, Allow_disposition__c> adobj = new Map<string, ...
0
votes
3answers
38 views

casting a map of Id, SObject to a map of Id, customObject

Map<Id, Segment__c> noLockedRecordsMap = (Map<Id, Segment__c>)new LockedRecordHandler().removeLockedRecords(newMap); The above compiles fine. Get this error at runtime: Invalid ...
3
votes
3answers
239 views

Adding a System.debug changes code behavior

I have the following code Map<Account, Integer> accountsMap = new Map<Account, Integer>(); Account a = new Account(); accountsMap.put(a, 1); a.name='Bob'; //System.debug(accountsMap); ...
0
votes
1answer
36 views

How to iterate map and assign value to field in lightning component?

I have list of account Ids in an array and list of accounts in array. I need to find the account Ids from the account list and want to change the status field. var accId=[]; //holding accIds var ...
1
vote
2answers
73 views

How to iterate and display nested map (map<string,map<map<string,string>,string>>) in vf page?

I am getting the value of map<string,map<map<string,string>,string>> for controller. I need to iterate and display the value in vf page, But I am not getting the output. <apex:...
1
vote
1answer
128 views

Add map values in lightning component

I want to add javascript map values to existing lightning map type variable Map type in Component <aura:attribute name="CheckedRecsMap" type="Map" default="{}"/> In js declaring a new map ...
0
votes
0answers
25 views

Processing & writing bulkified validation using more than 50k records

I have two fields in my Opportunity object: Phone_1__c & Phone_2__c. Now I have to check to check the whole Org, if there are any opportunities made earlier using any of these two numbers. (Org ...
0
votes
1answer
35 views

View Contact counts against each Account using Map [closed]

I'm Newbie. I like to get Contact counts against each Account Name using Map. I can get Contacts First Name related to Account Name but stuck to get Size of contacts.
0
votes
1answer
33 views

Error : Attempt to de-reference a null object ; on map variable

Class.ResourceProfileController.__sfdc_mapSummary: line 137, column 1 Class.ResourceProfileController.__sfdc_listWrapperEmployee: line 162, column 1 --> Error on the Variable mapSummary Hello I'm ...
1
vote
2answers
850 views

Complicated FOR loop nesting. Having trouble cleaning up legacy code

I am trying to tidy up some really bad legacy code from an old developer and I'm trying to get rid of these nested for loops. The code below shows what I'm currently working with. I've fixed this ...
0
votes
1answer
23 views

Insert a List collection into a Map Collection with the same index

I am trying to add a List of collection to a Map Collection with the same Index. I have this Code: List<Account> accountContactList = [SELECT Id,Name FROM Account]; Map<Integer,List<...
0
votes
1answer
38 views

How to Loop through a map that contains multiple object IDs?

Must be really simple but I am struggling with how to loop through this map. Gone through some examples but was unable to figure it out. Question is, how to loop through user IDs from TargetActorMap ...
-2
votes
2answers
28 views

Have custom map as return type in a class!

I am trying to have a class with map as return type. I am not sure how to return a custom map. Here is my code: public static Map<String,Integer,Integer,Integer> getMdus() { Map<String,...
0
votes
2answers
38 views

Convert List<String> into List<Schema.SObjectField>

I have a below code public PageReference SyncCandidatewithMirror(map<Id, cxsrec__cxsCandidate__c> NewMap,Map<Id, List<String>> fieldChangedMapChanged, List<...
0
votes
1answer
34 views

How to fill a Map with the fields of another map?

Map<String, String> SecondMap= new Map<String, String>(); SecondMap.put('IndexValue', 'Value'); Map <String,Map <String,String>> FirstMap= new Map <String,Map<String,...
0
votes
1answer
35 views

Method does not exist or incorrect signature: void put(String, String) from the type Map<String,Map<String,String>>

Below code throws this error: Method does not exist or incorrect signature: void put(String, String) from the type Map<String,Map<String,String>> Code: //I have this map Map <...
0
votes
1answer
43 views

“Attempt to de-reference a null object” for formula field in map

I am trying to get the value of formula field to check in condition via customAccMap. i am checking if formula_field__c is null then i need to throw a cpqException. But on Add Product Page on CPQ i am ...
-3
votes
1answer
34 views

Set contains (Filed name from Map<String, Schema.SObjectField> fieldMap ) not working

I have a below code to check the filed name inside the set to filed name inside the map. Map<String, Schema.SObjectField> fieldMap = Schema.SObjectType.Test__JobApp__c.fields.getMap(); set&...
0
votes
1answer
41 views

Add a new field with value to an already existing SObject

The goal is to get base64 of attachments of each record to render them in a visualforce page. Each record may have any number of attachments or no attachments at all. Map<Id, SObject> results =...
0
votes
1answer
408 views

How to parse nested objects in JSON response

Im trying to parse the below JSON response: { "preferredLanguage":"en", "preferredLocale":"en_GB", "languages":{ "en":{ "langCountry":"en-bn", ...
0
votes
1answer
22 views

Combine two List<Map<String, String>> for unique list

How can I combine two lists of maps so that only the unique values in the list remain? I thought about doing some nested for loops to compare the two lists, but it seems a bit messy. Is there a ...
0
votes
1answer
19 views

Clone a map containing an inner class so it passes by value and not reference?

I have a map<string, InnerClass>, where the inner apex class containing no sObjects, just a bunch of simple variable types like booleans, integers and strings. (It also contains another inner ...
1
vote
1answer
39 views

How do I optimize searching 3,000 records for an email that matches one on a lead?

Scenario A New Lead is inserted, if it matches criteria, the lead ownerid is Updated based on an email field on the lead. Problem Write code that takes the email address and queries all Users for ...
0
votes
1answer
29 views

Two Aggregate Results in one list (continue)

This post is the continue from here. David told me it is better to start a new post. My class is fine so far, I get no error. But if I try to display the results, I get an error "Unknown property '...
0
votes
1answer
31 views

Help bulkifying a simple trigger

I'm trying to create a trigger that sets a case status to "closed" if there are more than 2 cases created that day associated with the same contact. This is so far what I have written, but I'm ...
6
votes
1answer
57 views

Is the field describe result map a special type of Map?

I read in Accessing All Field Describe Results for an sObject: Use the field describe result's getMap method to return a map that represents the relationship between all the field names (keys) ...
2
votes
1answer
46 views

Too many SOQL queries - wanting to store in a map and check

I need to maintain a record for each month up to 10 years away, so 120 records ahead. This might be extended in the future! The code global with sharing class AccountingPeriodCreationService { ...
1
vote
1answer
76 views

inncorrect signature: void put(OpportunityLineItem) from the type Map<Id,OpportunityLineItem> [closed]

I have this below code which is throwing error. Can anyone help what is going wrong. Error Method does not exist or incorrect signature: void put(OpportunityLineItem) from the type Map Code Map&...
0
votes
1answer
35 views

APEX Would like to validate my approach [closed]

I have written the following REST callout to update Club & Players custom object. Based on the API ID club information is fetched and updated, same for players as well. For players I need to check ...