Questions tagged [for]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
2answers
92 views

Need to remove SOQL inside for loop

Below is my code snippet.Need to remove SOQL from for loop. for(Invoice_CU__c inv:Trigger.new){ List<Exchange_Rate__c> abc = [SELECT Exchange_Rate_to_Euro__c FROM Exchange_Rate__c where ...
6
votes
2answers
618 views

How to perform Soql query outside for loop?

I am inserting the opportunity line item based on the values of custom object. I am able to achieve this if I add the soql query inside for loop.But that is not an optimized solution. Can anyone ...
0
votes
1answer
119 views

FOR UPDATE in a Subquery?

I am assigned a POC project to consciously attempt a record and its children from one block of code and the other block of code would try to see how an update on such locked records behave. I am fine ...
1
vote
2answers
1k views

Cannot populate field value on new record with trigger

I am trying to write a simple trigger that will populate field values on a newly created record. I'm using standard objects: Account and Opportunity I have two custom fields on the Account object ...
-1
votes
1answer
29 views

using for getting the count of ids [closed]

i have a requirement like this,in my working project, for (Sobject aggregrate: aggregratecountList) { totalCount = Integer.valueOf(aggregrate.get('ID')); break; } ...
1
vote
1answer
1k views

Error:Loop must iterate over a collection type: User

I am getting error saying'Loop must iterate over a collection type: User'.I am not able to find what actually error wants to say. List<User> listUserDeactivate = new List<User>(); Set<...
2
votes
1answer
66 views

For loop for Map giving me various errors

I am unable to get a for loop for Maps working, I am new at this if you could, I would greatly appreciate it. I am just trying to iterate the the Trigger.oldMap keys, and, everything I try gives me a ...
3
votes
0answers
359 views

Lightning Component for Visualforce issue for Guest User

In answer to this thread - Expose Lightning App via Sites (and embed via Canvas) - Doug has mentioned that there is bug for guest user when using LC4VF. "There is currently an issue (actively being ...
0
votes
1answer
32 views

Need design help - weservice Real Time import of data to Salesforce and export as excel

Need to build export to excel functionality on salesforce but the tricky and imoortant part is that data resides in some other cloud system not salesforce. I have nearly 1 Million records in the ...
4
votes
1answer
133 views

Apex aggregrateresult error

Any help why I'm unable to add this? List<AggregateResult> revenue = [select SUM(Daily__c) rev, Client__r.Name from Commissions__c]; Integer totalMonthlyRevenue = 0; for ( AggregateResult i :...
1
vote
1answer
456 views

Reduce SOQL Queries

For every Account in AccountList, I need to make 2 different callouts - when a contact exists and 2nd when no contact exists. How can I reduce the no of SOQL queries in the below code. for(Account ...

1
2