New answers tagged

3

It is generally acceptable for bulk unit tests to use 200 records at a time. That is because this is the largest amount of data that will occur in a trigger from the UI or API (Apex, of course, is an exception, but you should only test for more than 200 if you reasonably expect it to occur). Even then, you may find that you'll run into CPU or heap limits. If ...


5

You can't test at that data volume. The DML rows limit is 10,000 in a transaction. You're seeking to run a test that inserts a total of 18,000 records in a transaction (both an Anonymous Apex execution and, loosely, a unit test area bounded by a transaction). That's never going to be possible. The 200 record batch you see in your logs is simply the trigger ...


2

By allowing partial updates (Database.update(records, false)), you're allowing a partial update; if an exception is later thrown, you've already modified some user records, and so you'd get this exception. Your best option would be to change your ErrorloggingClass to use Platform events to deliver the exception data asynchronously to a Platform Event Trigger ...


0

I ended up solving this as best as I could using a custom exception which I use to re-throw the exception after publishing the Platform Events related to the logging framework. The rough implementation is something like this: try{ // Do some Things }catch(Exception ex){ logger.error('Message',ex); logger.saveLogs(); GeneralException.rethrow(ex); } ...


1

Is it absolutely essential that you store the results of the first call out prior to making the second call out? If not you could simply assign your results to variables and persist the records after the second call out returns. Alternatively, you could still consider using future methods in combination with a UI updates based on data changes pattern like ...


0

You cannot perform DML before a callout. Knowledge Article here. You may have to break this up into multiple Apex methods called by the front end, sending responses to the front end and sending them back accordingly. There may be risks associated with it, so you'll have to determine if this is the right course of action for you. EDIT: Got the order wrong, ...


0

Try this one .cls throw new AuraHandledException('A customer with this email address already exists'); .js controller else if (state === 'ERROR') { var errors = response.getError(); if(errors) { if (errors[0] && errors[0].message) { var errorsMsg = []; errorsMsg.push(errors[0].message); cmp.set("v.errors&...


Top 50 recent answers are included