I recently had to modify my Apex class code because I ran a PMD Apex scan. After reading the SF docs, I made changes and the PMD Scan passed the code. However, when I started to deploy code, I am getting bunch of errors during deployed. Here is what I am getting:

1.Method does not exist or incorrect signature: void stripInaccessible(System.AccessType, Order) from the type System.Security

2.Method does not exist or incorrect signature: void stripInaccessible(System.AccessType, Account) from the type System.Security

I am really confused as to why I am getting this because I feel like I have followed the SF developer guide. Here is a sample of my apex class:

global with sharing class MyApexCtrl {
    global static String createOrder(String firstName, String lastName, String title, String accId){
        if(firstName != '' && lastName != '' && title != ''){
            Product2 pr = getProductRecord();
            //Contact objCon = getContact(firstName, lastName, title, accId);
            //System.debug('To show contact :: '+objCon);
            String priceBookId = [SELECT Id, Name FROM Pricebook2 WHERE Name = 'Standard Price Book' Limit 1].Id;
            List<PricebookEntry> listPBEntry = [SELECT Id, Name, Pricebook2Id, Product2Id, UnitPrice, IsActive, UseStandardPrice 
                                                FROM PricebookEntry WHERE Pricebook2Id =: priceBookId AND Product2Id =: pr.Id 
                                                AND IsActive = True WITH SECURITY_ENFORCED];
            Order ord = new Order();
            ord.AccountId = accId;
            ord.EffectiveDate = Date.today();
            ord.Pricebook2Id = priceBookId;
            ord.Type = 'Regular';
            SObjectAccessDecision decision = Security.stripInaccessible(AccessType.CREATABLE, ord);
            insert decision.getRecords();

Account accUpd = new Account(Id = accId, Order_Confirmation__c = true);
            SObjectAccessDecision decisionAcc = Security.stripInaccessible(AccessType.UPDATABLE, accUpd);
            update decisionAcc.getRecords();
            return 'Order created successfully';
        }else {
            return 'Error';

Can someone please help me resolve this? Why is this code not deploying and why I am getting these errors during deploy? Thanks

1 Answer 1


The most likely explanation I see is that your Apex class is set to an old API version, prior to the introduction of stripInaccessible(). Updating your class to use the latest API version (53.0 for production) should allow this code to deploy.

  • my API version is 53 Jan 27 at 14:27
  • do you see any other problem with my code? I am still getting error deploying the code Jan 28 at 0:15
  • Is the API version for this class (in its meta-xml file) set to 53.0? Just setting it in sfdx-project.json is not enough.
    – David Reed
    Jan 28 at 0:45
  • this is the meta file for the apex class: <?xml version="1.0" encoding="UTF-8"?> <ApexClass xmlns="soap.sforce.com/2006/04/metadata"> <apiVersion>53.0</apiVersion> <status>Active</status> </ApexClass> Jan 28 at 1:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.