3

Why would a simple method like

@RemoteAction
global static Custom__c upsertCustom(Custom__c custom){
    upsert custom;
    return [SELECT Id, Name, CalculatedField__c FROM Custom__c WHERE Id = :custom.Id];
}

cause a

Apex Methods Using Collections In Methods Bulkify

warning in the Checkmarx Scanner?

Note: Not sure if it matters, but from the javascript the method upsertCustom is not being called within a loop.

1 Answer 1

5

Seems like a false positive. In most cases a method that accepts a single record and performs a DML Operation on it might be called in a loop, and hence be considered non-bulk-safe. However, considering this method is a RemoteAction, that concern seems misplaced.

2
  • without RemoteAction, if I am sure a method is not being called inside a loop, can a false positive be given for it? Mar 6, 2020 at 7:25
  • Probably. I assume you'd just have to prove it.
    – Adrian Larson
    Mar 6, 2020 at 14:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .