+ Start a Discussion
Blake TanonBlake Tanon 

Odd failure: "Access to entity 'MatchingInformation' denied" on batch

I have a batch that's been running for years that started failing because of First error: Access to entity 'MatchingInformation' denied.  I've searched around and can't find anything about this and I can't find any object or class in salesforce called MatchingInformation.  It doesn't happen each time this batch runs, it seems to be arbitrary and can happen with any set of arguments.  The batch is below, simply it updates a list of records with a defined value.
 
global class util_sObjectFieldUpdaterBatch implements Database.Batchable<sobject>, Database.Stateful {

    /**
    Run This Batch

    string query = ;
    string nextBatch = ;
    string sObj = ;
    string field = ;
    object changeTo = ;
    integer batSize = ;
    
    ID idBatch = Database.executeBatch(new util_sObjectFieldUpdaterBatch(query,nextBatch,sObj,field,changeTo), batSize);
    **/

    global string query;
    global string nextBatch;

    global string sObjName;
    global string sObjFieldName;
    global sObjectType sObjType;
    global sObjectField sObjField;

    global object changeTo;

    private Map<String, Schema.SObjectType> smap = Schema.getGlobalDescribe();

    global integer NumBatches;
    
    global util_sObjectFieldUpdaterBatch(String qry, string nextBat, string obj, string field, object changeObj) {

        Query = qry;
        
        nextBatch = nextBat;

        sObjName = obj;
        
        changeTo = changeObj;

        SObjectType sObjType;

        if(smap.get(obj) != null){

            sObjType = smap.get(obj);

            Map<String,Schema.SObjectField> fieldMap = sObjType.getDescribe().fields.getMap(); 

            if(fieldMap.get(field) != null){
                
            	sObjFieldName = field;

            	sObjField = fieldMap.get(field);

            }

        }

    }
    
    global Database.QueryLocator start(Database.BatchableContext bcMain) {
        return Database.getQueryLocator(Query);
    }
    
    global void execute(Database.BatchableContext bcMain, List<sObject> scope) {

        for(sObject s : scope){
        	s.put(sObjField, changeTo);
        }

        if(scope.size() > 0) { 
            update scope; 
        }
    }
    
    global void finish(Database.BatchableContext bcMain) {

    } 
	
}

 
Best Answer chosen by Blake Tanon
Blake TanonBlake Tanon
Hi Vinnie,
I actually did find a way aroudn the error - I'm still not sure why the error occurred though or why what I did fixed it.  I moved the smap (Schema.getGlobalDescribe()) inside the main class instead, I assume the MatchingInformation is a new system object that is failing because of some sharing settings that sometimes are loaded late?  So moving any describes into a class/method where you can control when they are called seems to work.

All Answers

vscuorzo_visionevscuorzo_visione
Hi Blake,

I've been running into the same issue lately and was wondering if you found an answer to your problem. We have an app that we designed and installed into production over a year ago that worked perfectly fine up until earlier this year when we started getting the same exception you described and can't seem to identify a pattern leading to the error. Our batch jobs are simply changing the OwnerId on various objects such as accounts, opportunities, etc.

I've been dealing with Premier Support for over a week now and have yet to even get an explanation for what "MatchingInformation" is since it is not referenced by our code and does not seem to appear in the Salesforce documentation anywhere. I can't even seem to get any info on this object through the API's or anonymous Apex. If you've found a solution to this issue or even at least a little more info on it would you mind sharing? As usual, Salesforce support has not been much help thus far and we need to get this issue resolved.

Thanks,
Vinnie
Blake TanonBlake Tanon
Hi Vinnie,
I actually did find a way aroudn the error - I'm still not sure why the error occurred though or why what I did fixed it.  I moved the smap (Schema.getGlobalDescribe()) inside the main class instead, I assume the MatchingInformation is a new system object that is failing because of some sharing settings that sometimes are loaded late?  So moving any describes into a class/method where you can control when they are called seems to work.
This was selected as the best answer
Blake TanonBlake Tanon
I'm going to bump this back up, now I'm getting First error: Access to entity 'ConferenceNumber' denied