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
0answers
17 views

How to return account from wrapperclass

I want to display a relation of object in a visualforce page for Account>property__c>Booking__c>Order>OrderItem. With some help (Keith c) I have a wrapperclass to return the records by using a get ...
0
votes
1answer
49 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
51 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
47 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
31 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
38 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
32 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
28 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
39 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
7 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
42 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
43 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
34 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
62 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
65 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
35 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
54 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
43 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
27 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
61 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
48 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
215 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
35 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
47 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
30 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
26 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
51 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
18 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
73 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
23 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
143 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
19 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
54 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
44 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 ...
6
votes
3answers
312 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
37 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
112 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
387 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
36 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
859 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
24 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
39 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
46 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
36 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 <...