Stack Exchange Network

Stack Exchange network consists of 174 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
Make your voice heard. Take the 2019 Developer Survey now

Questions tagged [map]

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

0
votes
1answer
16 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
18 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 ...
-2
votes
1answer
34 views

How to display records of sobjects using map [closed]

please, let me know how can I display all records of sobject using map
1
vote
1answer
36 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
13 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
25 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
45 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
67 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
42 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> ...
-1
votes
0answers
28 views

Map key null not found in map error when trying to get related records for Account [duplicate]

Can anyone please help me with this problem.This error is showing only for PageBlockTable. If I use apex:repeat it's working but I need to use PageBlockTable. Map key null not found in map Error is in ...
0
votes
1answer
19 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
238 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
38 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
33 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
370 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
32 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
17 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
24 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
56 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
79 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
39 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
31 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
73 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
22 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
51 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
567 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
98 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
152 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
22 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 : ...
0
votes
0answers
22 views

update AccountID of contact with the Role's Account ID whenever the Role is created

I have to update the AccountID of Contact with Role's AccountID Whenever Role is created or updated. I am new to Maps so couldn't implement it properly, so Far I am doing using Inner loops and ...
0
votes
1answer
35 views

Need to change OwnerId field to Queue's Id if the creator of the record isn't from this Queue

I need to change OwnerId of created record to Queue Id, if the record is created not by User from this Queue. If creator is from this Queue, just leave our OwnerId field unchanged. How can I do that? ...
0
votes
0answers
19 views

Update values from Map<String,List<WrapperClass>> using visualfroce and apex

I'm creating a Map of String,List and using this map I'm displaying the values from keyset and List of records on the visualforce page. I'm providing some input text fields using these input text ...
0
votes
1answer
42 views

List<Object> into Map in salesforce [closed]

I have the following (List arguments) as a param to the method. I converted the list into Map in the following way. Map<Integer,String> nMap = new Map<Integer,String>(); for(Integer i=0;i&...
1
vote
2answers
31 views

Unexpected Token ERROR?

Any thoughts on why the errors? New to apex . Gentle with replies
0
votes
1answer
31 views

How to merge these two map into one map?

Set<ID> folderIDS = new Set<ID>(); Map<ID,Custom_Folder__c> foldersToUpdate1 = new Map<ID,Custom_Folder__c>(); Map<ID,Custom_Folder__c> foldersToUpdate2 = new Map<ID,...
0
votes
1answer
33 views

when i create opportunity i want to update noof opportunites count and amount fields in account object using MAP+SET+LIST IN CLASS

WHEN I TRYING TO INSERT OPPORTUNITY IT SHOWS ERROR LIKE THIS,WHERE DID I MAKE MISTAKE.... Apex trigger otherobj1 caused an unexpected exception, contact your administrator: otherobj1: execution of ...
0
votes
2answers
30 views

Changing a list of sObjects into a JSON

Having trouble with my apex code. I have a list of objects from my trigger that I want to transform into a JSON format - can't seem to work out a way to get it going and the code I have so far is ...
0
votes
2answers
132 views

Get Set ID from List in Batch Class

The ws_contact_callout class expects a SET of ids. in the Execute methods I attempt to get it but within the loop but the compiler is complaining. How can/should I get the Set of ids without requery?...
0
votes
1answer
22 views

Conversion of a list to map with key as Account and map as account's corresponding contacts from a list of accounts

I have a list accountList which contains corresponding contacts aswell. Now I am trying to make a map from that list with key as single account and corresponding associated contacts as value. public ...
0
votes
2answers
485 views

How to compare one Map keyset with another Map's field-value?

I am trying to compare a map that contains Contact ids to the Map that holds ContactId as one of the fields that I have queried in each key-value pairs. Map<Id, Contact> relatedContIdsMap = ...
0
votes
1answer
53 views

map.putall(fromMap) throws exception : Attempt to dereference a null object

I'm trying to copy entries from a map IdValueMapforDB into a static variable IdValueMap, in the execute method. But it always throws an exception on the line IdValueMap.putAll(IdValueMapforDB);. ...
1
vote
1answer
336 views

how to get value from map when wrapper class is the key

I have a wrapper class of picklist values and labels. I am creating a map with picklistValues and List as key and value types. Now, I am getting an error won this line -- objResults.get(...
0
votes
1answer
38 views

Get values from a map in apex

I have a map passed as parameter of an apex method. In this method I need to get the values of the map. Here is the apex method : @AuraEnabled public static String manageFilters(Map<String, ...
1
vote
1answer
48 views

Show a map of map data in table format in VF Page

I have a map called configMap. it is of type Map<String, Map<String, List<A__c>>> where it implies like Map<Obj, Map<Rec, List<A__c>>>. Just for understanding I ...
2
votes
2answers
23 views

Contact Account inside a Map of a Map - variable does not exist - account

I want to place leads and contacts within a Map so that I can access them on a visualforce page using a repeat component. Unfortunately I cannot access the Account values from the Contact object when ...
2
votes
3answers
288 views

How do Maps get populated when using SOQL

I am having trouble understanding how maps are populated in Salesforce. For example, what happens in the situation below: Edited code below: Map<Id, Account> accountMap = new Map<Id, ...