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
10 views

Updating all Opportunities related to trigger records

In a trigger for Cases, I need to know how many opportunities relate to each of those cases, through a lookup in the Case, that is Case.Oportunidade__c . This is the code: // this at the start of ...
0
votes
1answer
38 views

Why are child records I'm inserting in my test class not appearing?

an amateur apex user here and I have a question which I've tried to distill below as much as I can. I have a class OrderTriggerHandlerV2 which fires when Order.OriginalContractedOrder__c gets filled ...
0
votes
1answer
44 views

Map.get() not returning correct value

Hi I'm trying to create Map<String, Map<String, List>>. I want it to represent "Map<Owner Name, Map<Status, List< Work Orders>>>". In the debug log it is adding ...
0
votes
1answer
55 views

Sorting records in a before trigger

I have a one to many relationship between Project and Insurance. When a record is created on Insurance object, it needs to get the Project record and then count how many Insurance records are present ...
0
votes
1answer
25 views

Web to lead assignment to User with least open lead count

I have created a Map 'userIdWithOpenLeadCountMap' and grouped by OpenLeadCount in the ASC order. Then I am getting the first Key from the Map (UserID:005E0000003X2MH) and assigning a new lead to this ...
0
votes
1answer
27 views

Retreiving a Map<Object ,List<Object Line Items>> from a apex controller to lightning component

Hi I have an object as Product and another object as Product Line items. What I am trying to do is fetch data from my Apex Controller in the form of Map which has Product as key and List of Line ...
0
votes
1answer
30 views

Writing efficient code

I would like to understand the difference between snippet 1 and snippet 2. In snippet 1 I get a DML rows limit exception whereas in snippet 2, I don't get any exception. What makes snippet 2 not throw ...
-2
votes
1answer
36 views

Map<Id,List<String>> NEED TO GET Seperatd values from Multipicklist in a query

I have a scenario where i need to get multipicklist values from a query which are semicolon seperated values.I need to get them as Map<Id,list>and then i need to compare with another list of ...
0
votes
1answer
46 views

How to loop trough second level deserializeUntyped Json String [duplicate]

PLEASE NOTE: deserializeUntyped not deserialize! I currently loop trough a jsonPayload which is working fine for the nodes of the first level.How can I achieve this for the node(s) of the second level ...
0
votes
0answers
27 views

new Map is not adding value in lwc

I want to put my result( which returned from apex class) in Map to use in other place. But my map is empty. export default class contactUpdate extends LightningElement { @track condata = []; @track ...
0
votes
1answer
57 views

Ho to dynamically deserialize untyped a JSON with list

I have a JSON payload which is changing a lot so I want to create a way to dynamically deserialize the payload. My starting point is that the payload will consist of max 5 nested lists 5 levels deep. ...
-4
votes
2answers
119 views

JSON array into map with duplicate values [closed]

Final result when i tried the below code.
0
votes
1answer
46 views

Need a duplicate values in the Map

I have a list of the string contains duplicate values and I want to retain the duplicate value also in the Map and my code is below my list contains only 2 values while iterating in for loop I want ...
0
votes
1answer
34 views

Use Map instead of For loop in my Apex Trigger [duplicate]

I'm new to coding and I need help in modifying the apex trigger below to the correct one. Can you also help me in creating a test class for this? Thank you so much! trigger UpdateLadderedFields on ...
0
votes
2answers
59 views

Merge two map with same Key in apex

I have two maps with the same key now my question how to combine this into the third map? Map<String,object> newConMap = new Map<String,object>(004 ={CONTACTID=004, EMAIL=abc@gmail.com, ...
0
votes
0answers
37 views

Bulkify Apex Code

I have an Apex code allowing me to send alerts to the Head of Service of a Business Unit. Let's say a Case is created for the Business Unit APAC, then the Head Of Service APAC(aka John Smith) receives ...
0
votes
1answer
21 views

How to Optimise code to retrieve user NickName by querying fields from a custom object

I have currently have a code that sends alerts to Head of Service(user) of a Business Unit. So if a case has been created for the business Unit APAC for example, an alert is sent the the Head of ...
1
vote
2answers
121 views

exporting a map<string, map<string, object>> from lwc js module to apex

This javascript method builds an array of objects: handleSearch(){ let data = [...this.template.querySelectorAll('c-lwc-filter')] .map(filter => filter.exportData()); ...
0
votes
1answer
29 views

Changing value in Copied Map reflecting in Original Map [duplicate]

I am copying a Map from another Map. After the copying is done, I am changing the values in the new Map. However the new changes done in the new Map are also reflecting in the original Map. Is there ...
0
votes
0answers
38 views

invalid conversion from runtime type Map<ANY, ANY> to Map<String, ANY>

this is what I'm sending to apex: filter: {value: "1"} That is exported via this function in my js controller: @api exportData(){ let data = {}; if(this.isInput || this.isSelect || ...
0
votes
2answers
50 views

test class passing but not covering execute method

I have coded a batch class and am now working on the corresponding unit test. I believe I've inserted all the objects I need but none of the actual execute method is being covered, despite the test ...
1
vote
1answer
18 views

struggling to update field from a map

Having a little issue when working with a map and performing a field update in my apex code. I'm writing a batch that updates a field on the Contact object based upon a field on a custom object (lets ...
0
votes
1answer
17 views

Refer to parent object in Trigger [duplicate]

I have a trigger on Contact which gets fetches 2 custom field from account (customfieldaccount) and contact(customfieldcontact). I am having null value for the custom field on the Account object. Here ...
0
votes
0answers
47 views

Rendering a List<Map<String, Object>> in an LWC

I already posted a question about this, but I'm asking it again, differently. I'm importing a getFiltersJson apex method to my component (what it does, is export some filters I created in another ...
0
votes
1answer
44 views

How to get first n elements from map and put into another map?

I want to make a new map with first n elements from the existing map in apex. Please help. Map<String, Map<String, List<Custom_Object__c>>> limitedMap = new Map<String, ...
0
votes
2answers
54 views

Importing an apex methods that returns a List<Map<String, Object>>, how to renderize

I'm new to salesforce and development in general, so I'll be as clearer as I can be. I have to make a Lightning web Component that shows filters. The filters are created in apex. I made a class that ...
12
votes
1answer
274 views

System.hashCode still broken for Id

Five years ago there was System.hashCode broken on Id properties of SObjects? and I've just run into it again today. You can see the problem by running this test case: @IsTest static void ...
0
votes
1answer
8 views

Aura:map multi line descritpion

I have an aura:map with multiple point, and I wan't to have a multiple line descritpion as: descritpion : 'Account Name : ' + mapInfo[it][3] + '\nContact : ' + mapInfo[it][4] + '\nprice : ' + mapInfo[...
0
votes
2answers
33 views

Assign Map keys and values to Account

I have a map acctMap<id, decimal>. The keys are accountIds and value is a custom field. How to assign map keys to account ids and set the custom field to be the map values, so that I can update ...
0
votes
1answer
33 views

How To access a field from a Map Value?

I have an Object (ObjectA), which I have an important field called Motive. For every value in this field 'Motive', I'll have to send this 'ObjectA' to an external endpoint, changing accordingly with ...
1
vote
1answer
51 views

JSON with parent child data from list in apex

I am facing issues while adding list data: Here is my code: public class Wrapper{ public Boolean open{get;set;} public String label{get;set;} public String key{get;set;} ...
-1
votes
1answer
23 views

Need to return a String message in my method of type Map in the Apex class

My method is now returning null. However, I want to return a String saying that 'No value found'. My method is public static Map<Id,sObject>() type. Please refer to my code below: public static ...
0
votes
1answer
65 views

Help with creating map with Lead Id and Contact Id

I am creating a trigger which upon creation of a lead, searches for any contacts with a matching email, and if found - convert the lead, and set the ContactId on the lead. I am just having some ...
0
votes
1answer
18 views

Apex - Retrieve Json value from Map

I'm trying to compare Name and get same value from JSON in Map<String,Object>. "data":{ "list":[ { "Status":"ACTIVE", ...
0
votes
0answers
63 views

How can I synchronize multiple fields for all of an Account's contacts?

So we have two multi-picklist fields for contacts, Field1 and Field2. When the fields are updated, they should be updated for all that account's contacts, to have the same values (except where those ...
0
votes
1answer
28 views

Update a multipicklist value on Agreement object based on agreementLineItems field

I have two objects. Agreement and AgreementLineItems. It's a masterdetail relationship. One agreement can have multiple items. I have a billing_system__c formula field on agreementLineItem. It's value ...
0
votes
0answers
30 views

Compare two Set <String> and return list<String> that does'nt exist in Set2 [duplicate]

I am getting the desired result, but I want to avoid the nested FOR in my code. However my attempt failed. This is the best I could do. Can someone please guide me how I can avoid the nested FOR? // ...
0
votes
1answer
75 views

Unexpected token: 'Map' for method that returns a Map

Trying to create a method to return a Map of SObjects using any field I want (not Id or I would use the Map constructor that takes a List). private static Map<String, SObject> getSObjectMap(List&...
0
votes
1answer
82 views

how Can I remove query in for loop And want to avoid for loop with in for loop

This code is been hitting a governor limit and getting Too many SOQL queries: 101, based on research I found that I need to remove SOQL query from my for loop and the For Loops within For Loop. ...
0
votes
1answer
71 views

How to get Value from Key from returned MAP in JavaScript in Salesforce lightning

I m trying to access values in map in JavaScript controller(aura component). Map is being returned from Apex class. var mapVals = response.getReturnValue(); for (var key in mapVals) { alert('@@::...
0
votes
1answer
23 views

Adding a value to a Map value with Before Update

I am still learning to develop so thank you in advance for your help! I have used the Lightweight Trigger Framework from Chris Adlridge. Seen here The objective is to make a checkbox True if one of a ...
1
vote
1answer
36 views

Looping through Inner Query Best Practice

Looking for some general guidance on the best way to deal with getting to and looping through inner queries of SOQL. At a high level, I have a trigger on Opportunity stage. If the opportunity stage is ...
2
votes
1answer
102 views

LWC - map function is working on console but not on the page

The idea is to remove duplicate id's upon selection of records using checkbox. Below is the code used. selectedTaskObj3 = []; let el = this.template.querySelector("lightning-datatable"); let ...
3
votes
0answers
53 views

LeaftLet map is not loading in LWC

I have a simple leaflet map in LWC, libraries are loading successfully, however, the map is not rendering. Am I missing anything wrong? <template> <div class="map-root" lwc:dom=&...
0
votes
2answers
31 views

Why is there a need for parenthesis on the right side of the equal sign when assigning a Map variable?

I have a question regarding the second portion of this code snippet. When using the "Map<String, Object>" assignments, why is it that I have to use parentheses around the Map<...
0
votes
1answer
39 views

Variable does not exist error - SOQL for loop

What could be the problem in below code. I am getting the error "Variable does not exist : Account" List<Opportunity> opp = [Select o.Id, o.AccountId, o.Account.Description from ...
0
votes
1answer
42 views

Working with Maps

I am passing a list of opportunities (opplist) to a method. For each opportuntiy, I have to check the description field of its related account. And based on that field, I will add the respective list ...
0
votes
1answer
31 views

How i can access to Map methods in visualforce page

Hello I'm a beginner in Salesforce and i have to access to Size method of a Map but I need access in my VFP, the controller is: variable = new Map<string,Map<string,boolean>>(); variable....
0
votes
3answers
177 views

Pass Nested Map from Apex to JavaScript Controller

I am currently working on a Lightning Component. Within my Apex Controller I have a nested map looking like this: Map<LineItem, Map<LineItem, Map<LineItem, Map<String, LineItem>>>&...
1
vote
2answers
134 views

How to deserialize list with map to wrapperclass

I have a string which I am trying to deserialize to a wrapperclass / object. But get the error: Expected Map<String,String> but found [line:1, column:3] Wrapperclass global class ...

1
2 3 4 5
15