Hot answers tagged

3

To check the list empty value, You can use these methods from List class:- isEmpty() Returns true if the list has zero elements. Example:- !opportunitiesMap.get(actualTool.Rent__r.Opportunity__c).OpportunityInfo__r.isEmpty() size() Returns the number of elements in the list. Example:- List<Integer> myList = new List<Integer>(); Integer ...


3

When You say I used a list to get the values of the custom metadata fields. First of all, You should consider that [SELECT A__c, B__c, C__c FROM CustomMetadata__mdt] SOQL returns you a list of CMT records, not fields. So if You want to get a concrete record of CMT you should specify filter conditions [SELECT A__c, B__c, C__c FROM CustomMetadata__mdt ...


2

sobjList is a generic List<sObject>. The sObject class has no property Case__r, and Apex does not resolve properties like this at runtime. The easiest way to handle this is to declare the result as a List< Staging_order__c>, so that the result of get() is an actual Staging_order__c which has the requisite properties. You could also cast the ...


2

You can create a separate list to keep track of the cases associated to the budgets. This works because of the fact that objects are stored by "reference", meaning that an update to one object in memory affects all its references. Here's how you can do that: List<Case> allCaseList = new List<Case>(); List<Case> budgetCaseList = new List<...


1

I cleaned up your code a little bit to fix some Bulkifying pitfalls, but to David Reed's point we still need your Trigger code to help you out further: public class NaicsExclusion { public static void CompareCodes(Account[] accs) { List<NAICS_Exclusion__mdt> BadCodes = [SELECT Name__c FROM NAICS_Exclusion__mdt]; for(Account a :...


1

There is an issue in the loop exit. In case if i equals arr.size() - 1, it will still not exit the loop, but rather try to access i+1 element of an arr array, and that would cause an exception. This is proper code public static List < Integer > getMovingSum(List < Integer > arr) { List < Integer > movingSumList = new List < ...


Only top voted, non community-wiki answers of a minimum length are eligible