Linked Questions
43 questions linked to/from How do I bulkify queries for directly or indirectly related records?
0
votes
1
answer
3k
views
callout inside for loop [duplicate]
I am inserting multiple records in a transaction then i have to send those details to another system. Currently after inserting i am querying the records in a list and inside for loop doing the ...
-1
votes
1
answer
3k
views
How to query two unrelated objects? [duplicate]
I want to query two unrelated objects, and I can't create a lookup relationship between them.
They have the same global picklist sets in both of them and I want to query the records from one of the ...
1
vote
1
answer
2k
views
SOQL query on non-related objects [duplicate]
Account is a parent to Object B and Object C. Object B and Object C does not have any relationship.
From Object B I want to find Object C's fields(like name etc.,) using Account in a single SOQL query....
0
votes
1
answer
1k
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
1
answer
1k
views
How to avoid for loop and use map or some other technique for below logic [duplicate]
I have below code ,but not able to understand how i can avoid second for loop inside account
please suggest
public static void getOpenCaseOnAccount() {
Map<id,user> userIds = new map<...
0
votes
1
answer
914
views
how to avoid SOQL query inside for loop? [duplicate]
I have below code in which there is a SOQL query inside for loop. I have been advised to use map to avoid SOQL in the loop. As i am a beginner in Salesforce I dont know how to do it. Here's my code
...
-2
votes
2
answers
432
views
How to relate a Case with a Contract using Apex? [duplicate]
Use case :
Once contract is inserted with :
record type = B2C
AccountId = Case.AccountId
ContactId = Case.ContactId
GEG_Correspondance_Offre_Produit__r.Type_Energie__c = Case....
0
votes
1
answer
318
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
1
answer
367
views
After Insert Trigger on Email Message to Update a field on Case [duplicate]
I have one custom checkbox field on Case named Check__c and I want it to be checked if the From Address of the incoming email message linked to that case is equal to the Case Owner's email. there is ...
0
votes
1
answer
361
views
How to pull SOQL-query out of the loop in the trigger [duplicate]
Hello) I need to create a trigger that will record the number of reviews and the average rating from custom object (Review__c) in the corresponding fields on other custom object (Job_Applications__c). ...
-3
votes
1
answer
226
views
How to prevent loop in batch correct way [duplicate]
I have the following Batch which currently runs. I am still wandering if the way I set my for loops are correct. Is this solution the right way?
I have a Quote which is related by several amount ...
0
votes
1
answer
178
views
SOQL to be outside of for loop [duplicate]
I am new to Apex and I am trying to make SOQL to be outside of FOR Loops but then my trigger stopped working. Here is my code:
trigger AccountFieldUpdate on Contract (after insert, after update) {
...
0
votes
2
answers
86
views
How to avoid using SOQL with in For loop? [duplicate]
When i run the test code, it throws me message "System.LimitException: Too many SOQL queries: 101". How do i avoid using too many SOQL in this code.
trigger GetObjLabel on Task (before ...
-3
votes
1
answer
97
views
Bulkify the code [duplicate]
I have below code Please tell me how can i bulkify it:- Its checking for duplicate email and if found then a task is created. But because of this class many test classes are failing with error as too ...
0
votes
0
answers
55
views
Trigger to update fields from one object to another (Relationship unrelated to each other ) [duplicate]
I have two custom objects:-
1.Product__c:- Fields - L1__c,L2__c,L3__c,L4__c,L5__c,Origin__c,Craft__c,Fabric__c,Zari_type__c
2.L1_L5_Master__c:-Fields - L1__c,L2__c,L3__c,L4__c,L5__c,...