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.

0
votes
3answers
24 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
194 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
26 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
43 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
30 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
32 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
30 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
840 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
20 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
34 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
25 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
31 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
32 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
30 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
30 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
23 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
31 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
320 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
20 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
25 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
30 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
53 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
72 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 ...
1
vote
2answers
85 views

How do I merge multiple Map/JSON Object into One Map

I am trying to build a json out of List of Maps but I need to merge few maps together when matching key is found. How can I merge few Apex Map Object values ? For example: Map<String,Object> ...
0
votes
1answer
27 views

APEX Map <String,Custom Object> GetKey Issues on trigger

I am building a trigger to update ownership of Leads however while creating my map using String, Custom Object for somereason that I am unsure of is not finding the Key. When using the debuger logs I ...
6
votes
3answers
251 views

Select into Map using Database.query()

So we all know it is possible to directly select into a Map, like this: Map<Id, Account> accounts = new Map<Id, Account>([SELECT Id, Name FROM Account]); Is it possible to do the same ...
2
votes
1answer
42 views

Combine two lists in to one visualforce table

I Have to lists with different records but using only one object. Like Example Apex Controller: List<Commission_Setting__c> minChargeOTC = [Select Id, Commission_for__c, Rate__c From ...
-1
votes
1answer
42 views

on trigger upsert: if value not found in select , create a new row in different object

I am having a beastly time trying to in a trigger, check the oldmap vs new map, if a certain value exists, check for existence of a row in another object, if that row exists update, otherwise insert a ...
1
vote
4answers
399 views

How does class Map work?

I trying to learn Triggers from TrailHead, but not able to understand this line of code. Map<Id,Account> acctsWithOpps = new Map<Id,Account>( [SELECT Id,(SELECT Id FROM Opportunities) ...
0
votes
2answers
36 views

Add second element of map (multiple same ID)

I wanted to know how to get the second element of my oppTeamMemberWrapper map knowing that its ID exists in several times in the wrapper map (the ID being the ID of the parent opportunity)
0
votes
1answer
18 views

Trigger - Get all occurence of map in same get

I have a map map like that and I wanted to know if I could get all the occurrences of my key in one and the same list (without making a loop). Would you be able to do that? @future public static ...
0
votes
2answers
34 views

Error Method does not exist or incorrect signature

Getting the following error at line number 7. Method does not exist or incorrect signature: void add(Auto_Risk_Fill__c) from the type Map List<Auto_Risk_Fill__c> autoValues = new List<...
0
votes
1answer
64 views

Two Aggregate Results in one list

I've changed the code again, but I still get an error. But now I get the error: Constructor not defined: [VTP31_class.CombinedSummary].(AggregateResult, AggregateResult) in row 35, column 35 CLASS ...
0
votes
1answer
58 views

Need Help with a Map

I need to create a map between a custom object and a List, my code right now is this: Map<Invoice_Header__c, Contact> headersToContact = new Map<Invoice_Header__c, Contact>(); List<...
2
votes
2answers
128 views

(Lightning Component) sObject map keys turn into strings when passed from Apex to Javascript

My Apex controller returns a map<Account, list<String>> map type to my Lightning JS controller. But when I access it in my component's JS controller, the map turns into an object! This ...
0
votes
2answers
50 views

how to get a value after from result callout

I have the following where the result format of the callout is the following: [ { "uid": "72852a55-5be3-496c-904c-fc3fd261f0a4", "name": "Responseev Agency" }, { "uid": "66852a55-...
0
votes
2answers
33 views

How to get the value from an object

I have an object which gives me the following when I debug :- {name=Baltmore, uid=abcdef00-acft-126a-8cfw-efihfcirffw} I would like to get the uid as a string. I tried agency.get('uid') but this ...
2
votes
2answers
121 views

Updating Map values returns list exception (row with duplicate Id at index: X)

I have a list of tasks that need to be updated. To avoid duplicates, it first gets converted into a Map<Id, Task> whose values are updated as follows: Map<Id, Task> mapIdTasksToUpdate = ...
0
votes
1answer
24 views

Can we use a map in HttpPost to make our code shorter? (too many fields and we can add more in future)

Can we use a map? And how to do that? Too many fields here already and we can add more in future. @HttpPost global static Ticket__c postT(String title, String whattime, String whatdate, String ...
0
votes
1answer
142 views

Callout error Invalid conversion from runtime type List<ANY> to Map<String,ANY>

I just followed a trailhead on callouts and I am trying to get some values from an endpoint. My debug shows me my status is ok but I get an error on line 17: Callout error Invalid conversion from ...
2
votes
1answer
26 views

POST a record from Org1 to Org2 with JSON and Map

I need to post created record from Org1 to Org2. I want to "put" my JSON into Map and just "open" Map in another Org. Needed result: fields from new Org1 Object's record = fields from new Org2 Object'...
2
votes
2answers
1k views

lightning:map doesn't refresh

I'm trying the new lightning:map tag from the winter 19 and i'm having some issue. I achieve to display a simple map filled with a list of objects. They are shown as markers on the map and also on a ...
0
votes
1answer
156 views

Using Maps instead of nested for loops in APEX

Hi i'm really new to Salesforce development in the following code I'm trying update existing record to inactive but, not the coming record on two different conditions. I'm a bit confused in the last ...
6
votes
1answer
197 views

SOQL AggregateResult Query throws error: System.ListException: Row with null Id at index: 0

Background I have this Apex SOQL query: myMap = new Map<Id, AggregateResult>([SELECT OpportunityLineItemId, MIN(ScheduleDate) Starts ...
3
votes
1answer
25 views

apex - Internal server error when getting Element of a List of Maps

I am passing a List of Maps to my controller from the client-side javascript, and when trying to access an element of this list, an internal error is thrown. Here is an example of the problem : ...