• Dinesh Yadav 34
  • NEWBIE
  • -1 Points
  • Member since 2022

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies
Hi All
can you please share interview questions and different senarios which ask for experienced sfdc developers
 

Hi,

 

Please provide "Salesforce Solution Architect" interview questions.

 

Thanks in advance.

 

 

 

 

I am trying to execute the following code for recalling an approval process an ends up getting the following error

 

 

execution of AfterUpdate caused by: System.DmlException: Process failed. First exception on row 0; first error: INVALID_OPERATION, Illegal transition type:

 

 Approval.ProcessWorkItemRequest pwr = new Approval.ProcessWorkItemRequest();
       
List<ProcessInstance> procins = new List<ProcessInstance>([select Id from ProcessInstance where Status = 'Pending' and TargetObjectId = :objectId]);
// Retrieve the process work instance id associated to the process instance
            List<ProcessInstanceWorkitem>  workitem = new List<ProcessInstanceWorkitem>([select Id from ProcessInstanceWorkitem where ProcessInstanceId = :procins[0].id]);

            if ((workitem != null) && (workitem.size() > 0))
            {
                pwr.SetComments(statusToUpdate);

                pwr.setWorkItemId(workitem[0].id);
                pwr.setAction('Remove');
            
               
                // Execute process request
                Approval.ProcessResult pr = Approval.process(pwr);

}