New answers tagged

2 votes
Accepted

Method does not exist or incorrect signature: void add(String) from the type List<Account>

You can only put data into a list that's the same type that the list was declared with (or a compatible type). Your list is a List<Account>, a list of Account. While acc inside of your loop is ...
  • 53.4k
2 votes

Method does not exist or incorrect signature: void add(String) from the type List<Account>

You simply need to change: acclistToUpdate.add('acc'); to: acclistToUpdate.add(acc); That said, you are updating every record in acclist, so maintaining a separate acclistToUpdate variable is ...
  • 146k
0 votes

Test Class Showing in Code Coverage Window as Available for Coverage

@KB2021, this is due to the createTestData method in your test class. This should be annotated with @testSetup rather than just being defined as a private method within the test class. Details about ...
0 votes

Time Limit Error on After Save Flow that sends out emails

This is normal and also happens to me as well. It's the Email Alert itself that causes this to happen. The Email Alert is not happening asynchronously, as such it slows down the processing of the flow ...
0 votes

Can a DML retry solve UNABLE_TO_LOCK_ROW race conditions?

I spoke with SF about this issue. Apex detects deadlocks via timeout. Retry by repeating the DML may be a viable technique. The important thing to understand is what you are effectively doing is ...
  • 101
1 vote

Batch avoid inserting duplicate records

Can you set that external Id as Unique on the Account object ? If yes, then you can use in the execute part a Database.insert(recordsToInsert, allOrNone). Set the boolean to false, that way if you try ...
  • 97
0 votes

Batch avoid inserting duplicate records

Instead of using insert operation use upsert operation with external Id. E.g. if your list name is accountsList and External Id field name is ExternalId__c replace your insert DML with below dml ...
  • 1,190
0 votes

System.LimitException: Too many queueable jobs added to the queue

if this is of any help, I execute the batch with 1: yourClass b = new yourClass(); //ur batch class database.executebatch(b,1); this way, the queues are not chained.
0 votes

Workbench Settings: "Preferred Query Batch Size" parameter missing?

I don't think you can set batch size in workbench. Kindly review limitation here.
  • 2,070
1 vote
Accepted

Batch Apex Class to update lookup field

Line 12: Invalid bind expression type of Account for column of type String Customer_Price_Group__c isn't a lookup to Account, and you can't bind a List of Sobject unless you want the Id. You need to ...
  • 456k
0 votes

Notify Lightning Component when ApexBatch finishes

LWC can also catch Platform events sent by a Batcheable: See the documentation for an example of subscribing a LWC to Platform events Publishing your event can be done in the finish method of a batch: ...
1 vote

can we override start() method for batch apex

To answer this directly, yes you can write a Batchable that overrides the start method just so long as your Batchable implementation extends another abstract or virtual implementation of Batchable ...
  • 30.6k
3 votes

can we override start() method for batch apex

When you implement an interface, you aren't overriding anything. You're simply stating that the class will have these particular methods available. This is why the keyword for using an interface is ...
  • 456k
1 vote
Accepted

can we override start() method for batch apex

When implementing a Batchable interface, you have three methods which you must implement. void execute(Database.BatchableContext param1, List<Object> param2); void finish(Database....
1 vote

Question regarding Batch class

The Database.getQueryLocator method will directly accept a SOQL query string so: String query = 'SELECT ' + String.join(lstFieldNames, ',') + ' FROM Case limit 2'; return Database.getQueryLocator(...
  • 132k

Top 50 recent answers are included