You need to sign in to do that
Don't have an account?
davidesi
INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY when submiting Approval Process
Hi!
I'm trying to reassign the actor of an approval process and I'm getting that error : INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY
This is the main code:
try{
Approval.ProcessResult result=AprobacionHelper.aprobarOportunidad(op, obs);
System.debug('resultado de la aprobación ========>' +result);
Reasignacion__c r = AprobacionHelper.recuperaAprobadorReasignadas(op.Id);
if (r!=null){
List<Id> newWorkItemIds= result.getNewWorkitemIds();
///
// First, get the ID of the newly created item
List<Id> nwii = result.getNewWorkitemIds();
///
AprobacionHelper.reasignar(nwii, r);
}
}catch(Exception e)
And the methods:
public static Approval.ProcessResult aprobarOportunidad(Opportunity op,Observaciones__c obs){
Approval.ProcessSubmitRequest req1 = new Approval.ProcessSubmitRequest();
req1.setComments(obs.Observacion__c);
req1.setObjectId(op.Id);
// Submit the approval request for the account
Approval.ProcessResult result = Approval.process(req1);
return result;
}
public static void reasignar(List<Id>newWorkItemIds,Reasignacion__c r){
Approval.ProcessWorkitemRequest req2 = new Approval.ProcessWorkitemRequest();
req2.setComments(r.Comentarios__c);
req2.setAction('Approve');
req2.setNextApproverIds(new Id[] {r.aprobador__c});
req2.setWorkitemId(newWorkItemIds.get(0));
Approval.ProcessResult result2 = Approval.process(req2);
}
And there I got following error message:
10:35:11.596 (596521000)|EXCEPTION_THROWN|[57]|System.DmlException: Process failed. First exception on row 0; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id: []
10:35:11.597 (597507000)|SYSTEM_METHOD_EXIT|[57]|Approval.process(Approval.ProcessRequest)
I'm trying to reassign the actor of an approval process and I'm getting that error : INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY
This is the main code:
try{
Approval.ProcessResult result=AprobacionHelper.aprobarOportunidad(op, obs);
System.debug('resultado de la aprobación ========>' +result);
Reasignacion__c r = AprobacionHelper.recuperaAprobadorReasignadas(op.Id);
if (r!=null){
List<Id> newWorkItemIds= result.getNewWorkitemIds();
///
// First, get the ID of the newly created item
List<Id> nwii = result.getNewWorkitemIds();
///
AprobacionHelper.reasignar(nwii, r);
}
}catch(Exception e)
And the methods:
public static Approval.ProcessResult aprobarOportunidad(Opportunity op,Observaciones__c obs){
Approval.ProcessSubmitRequest req1 = new Approval.ProcessSubmitRequest();
req1.setComments(obs.Observacion__c);
req1.setObjectId(op.Id);
// Submit the approval request for the account
Approval.ProcessResult result = Approval.process(req1);
return result;
}
public static void reasignar(List<Id>newWorkItemIds,Reasignacion__c r){
Approval.ProcessWorkitemRequest req2 = new Approval.ProcessWorkitemRequest();
req2.setComments(r.Comentarios__c);
req2.setAction('Approve');
req2.setNextApproverIds(new Id[] {r.aprobador__c});
req2.setWorkitemId(newWorkItemIds.get(0));
Approval.ProcessResult result2 = Approval.process(req2);
}
And there I got following error message:
10:35:11.596 (596521000)|EXCEPTION_THROWN|[57]|System.DmlException: Process failed. First exception on row 0; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id: []
10:35:11.597 (597507000)|SYSTEM_METHOD_EXIT|[57]|Approval.process(Approval.ProcessRequest)
https://help.salesforce.com/apex/HTViewSolution?urlname=INSUFFICIENT-ACCESS-ON-CROSS-REFERENCE-ENTITY-error-message-1327109075127&language=en_US (https://help.salesforce.com/apex/HTViewSolution?urlname=INSUFFICIENT-ACCESS-ON-CROSS-REFERENCE-ENTITY-error-message-1327109075127&language=en_US)
But I wasn't trying to edit none setup configuration but a Approval process approver.
Just wanted to check if your code is using with sharing or not.. As per my understading the , the error is coming because the User who is running the code either does not have access to the record or does not have permission to change the aaprover. Try running as system admin and check if it throws the same exception.
Thanks,
Shruti