• vscuorzo_visione
  • NEWBIE
  • 0 Points
  • Member since 2015
  • Software Engineer
  • Vision-e

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
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) {

    } 
	
}