Hot answers tagged

5

Based on the documentation of the User object, if you remove a language from the Displayed Languages, the corresponding PicklistEntry becomes inactive. Based on my experimentation, this appears to hold true. In API version 47.0 and later, when using the DescribeSObjectResult API to return PicklistEntry values from this picklist, the active value indicates ...


4

You cant get more than 50k rows via SOQL. Query and Querymore are present not in apex but in Rest and SOAP API. They give cursor that allows getting more records. Internally, if you use SOQL for List's it uses to query and querrymore. But its for heap trick, not for getting more rows than what governor has specified. for (List<Account> listAcc : [...


4

No, UnexpectedException, AssertException, and LimitException are all uncatchable. Easy enough to verify via Execute Anonymous: try { throw new UnexpectedException(); } catch(UnexpectedException e) { }


2

We use the object oriented approach of using non-static methods because of the massive benefits we can derive in unit testing (and potentially also in production cases, though we don't do that yet). We take a "dependency injection factory method" or "dependency injection singleton access" approach. Each of our trigger handlers provides an interface or set ...


2

Your JSON doesn't match your data structure. In Apex, you have public cls_Transaction[] Transactions; in the plural, but your JSON has "messages":{ "Transaction":[ { in the singular.


2

Limit exceptions are not able to be caught and handled. I don't think it's called out very clearly in the documentation, but it is in there. From the Exception Classes and Built-In Exceptions page LimitException    A governor limit has been exceeded. This exception can’t be caught. The closest thing you'd be able to do is monitor the ...


2

You can reduce total SOQL queries to 3. 1) Store your values in Sets, for example: Set<String> values4 = new Set<String>(); for (List<String> row_i : csvRecords) { values4.add(row_i[4]); } Make the same for other values. 2) make SOQL query to your objects with Id IN :values4, something like: Map<Id, RelatedObject__c> ...


2

Refer below Test class. I've modified a bit and invoked Schedular: @isTest public class EmailScheduleTest { @isTest static void sendEmail(){ List<Tool__c> lstTool = new List <Tool__c> (); Tool__c tool = new Tool__c( Name = 'Test', Email__c = 'test@test.com', Email_content__c = 'Test email ...


1

From Salesforce help Some special types of built-in exceptions can’t be caught. Those exceptions are associated with critical situations in the Lightning Platform. These situations require the abortion of code execution and don’t allow for execution to resume through exception handling. One such exception is the limit exception (System.LimitException) ...


1

Use __r child relationship query if in your Account object actually has a lookup field to Junc_Account_Address__c. The inner for loop below is not needed. for (Junc_Account_Address__c ac : scope) { for (Account acc : ac.Account__r) { } } Also, since you are referencing some fields from the Cust_Address__c, you need to include them ...


1

You can use data-<attribute> <button class="slds-button slds-button_outline-brand" onclick = {openEditLimitModal} data-id = {rfiles.Id} data-bank-name = {rfiles.bankName}> Edit Limits </button> This is how you can access these data properties. event.target.dataset.id event.target.dataset.bankName


1

I would say your query should be based on the junction object. Therefore you don't need a map, because a junction object itself has the Map characteristic (key => value) List<Account> accountsToUpdate = new List<Account>(); for (AccountAdress addr : [SELECT id, startdate, enddate, account__c, addres__c FROM AcountAdress WHERE ...


1

You should query the database to get the actual values before trying to update the record: Map<Id, Purchase_Order_Line__c> currentData = new Map<ID, Purchase_Order_Line__c>([ SELECT Quantity_Received__c FROM Purchase_Order_Line__c WHERE Id = :selectedLines ]); for (Purchase_Order_Line__c selectedLine : selectedLines) { try { ...


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