+ Start a Discussion

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; }

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.