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
JaiJai 

Permissions should be checked before accessing resource {0}.

below heighleted code scan issue  pls help me on  this.

public static void continueCreateTicket(List<Case> caseList) {
    if(Schema.sObjectType.Customer_Support_Internal_Request__c.isAccessible()) {
    final List<Customer_Support_Internal_Request__c> newCsir;
    newCsir = new List<Customer_Support_Internal_Request__c>();
    Customer_Support_Internal_Request__c csir;
    for(Case caseRec : caseList) {
        csir = new Customer_Support_Internal_Request__c();
          csir = doGetCSIR(caseRec,csirEarlyId); 
        if(csir != null) {
            newCsir.add(csir);
        }
    }
    if(!newCsir.isEmpty() && Customer_Support_Internal_Request__c.sObjectType.getDescribe().isAccessible()==true) {       
                    insert newCsir; 
    }
    }

Thanks!!
Prateek Prasoon 25Prateek Prasoon 25
To fix this issue, you should add a check to ensure that the running user has access to the Customer_Support_Internal_Request__c object before using it. For example, you can modify the code as follows:
if(Schema.sObjectType.Customer_Support_Internal_Request__c.isAccessible()) {
    if(Customer_Support_Internal_Request__c.sObjectType.getDescribe().isAccessible()) {
        final List<Customer_Support_Internal_Request__c> newCsir;
        newCsir = new List<Customer_Support_Internal_Request__c>();
        Customer_Support_Internal_Request__c csir;
        for(Case caseRec : caseList) {
            csir = new Customer_Support_Internal_Request__c();
              csir = doGetCSIR(caseRec,csirEarlyId); 
            if(csir != null) {
                newCsir.add(csir);
            }
        }
        if(!newCsir.isEmpty()) {       
            insert newCsir; 
        }
    } else {
        // Handle case where running user does not have access to the object
    }
}

If you find this answer helpful, Please mark it as the best answer.