function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sfpsfp 

Throwing Warning for checkmark code scanner

Hi All I have submited the sorce code scanner checkmark. I am getting the following error in my code please suggest me.

Our code:

public static void insertAsSystem(sObject obj){ insert obj; }
public static void updateAsSystem(sObject obj){ update obj; }
public static void upsertAsSystem(sObject obj){ upsert obj; }
public static void deleteAsSystem(sObject obj){ delete obj; }

CheckMark Scanner:
Query Name - Bulkify_Apex_Methods_Using_Collections_In_Methods
Severity - Warning
46. public static void insertAsSystem(sObject obj) insert obj; }

Thanks
James LoghryJames Loghry
In general, the security scanner frowns upon passing in single variables, especially when performing DML operations.  This is simply a warning, and you should be able to pass security review.  That being said, if you wish to address the warning, simply update your method and any methods calling insertAsSystem to take a list of sobjects, and you should be good to go.