2 Replies Latest reply on Jul 1, 2019 1:03 AM by Sneha Wakale

    Remedyforce pending approvals, autoclosure

    Antti Tapiola
      Share This:

      Hi,

       

      what kind of workaround you have implemented for handling pending approval requests?

      We have time based workflow to close tickets which approval has been pending too long, but I'm thinking how to handle actual approval processes? If ticket is closed pending approvals can still be seen by Manager through Self Service portal.

       

      Yes, I believe it can be done through apex, but are you aware of way to do it through Remedyforce configuration in more easily?

       

      -Antti

        • 1. Re: Remedyforce pending approvals, autoclosure
          Neena Ahirrao Guha

          Hi Antti Tapiola

           

          By any chance have you able to resolve your use case? If not you can try following -

           

          Create apex class with following code -

           

          public class RecallApproval {

              @InvocableMethod(label='RecallApproval')

              public static void RecallApproval1(List<id> recId){

                      ProcessInstanceWorkitem[] workItems = [ SELECT Id

                          FROM ProcessInstanceWorkitem

                          WHERE ProcessInstance.TargetObjectId = :recId ];

                      Approval.ProcessWorkitemRequest pwr = new Approval.ProcessWorkitemRequest(); 

                      pwr.setAction('Removed');

                      pwr.setWorkItemId(workItems[0].id);

                     

                      Approval.ProcessResult result = Approval.process(pwr);

              }

          }

           

          Then please create process builder to call this apex class when the status is changed to Canceled -

          P1.png

          P2.png

          • 2. Re: Remedyforce pending approvals, autoclosure
            Sneha Wakale

            Hi Antti,

             

            I would suggest write a scheduler to either approve pending records or reject pending records, also you can add approval/rejection comment.

            For  this you need to write apex code.

             

            Neena Ahirrao Guha

            Sorry to say, but, recalling pending records will not be right approach.

             

            Regards,

            Sneha Wakale

            1 of 1 people found this helpful