How To Create New Approval Records Instead of Canceling When Reversing Workflow

phuonmi
Tera Contributor

Hi,

 

I found some scripts to reverse the workflow. However, it cancels the approval records or resets their state instead of creating new ones. 

 

For example:

 

    new global.WorkflowApprovalUtils().cancelAll(current, comment);

    new global.Workflow().startFlow(workflowID, current, "insert");
 

Is there a way to reverse the workflow while keeping the old approval records unchanged (so they remain as "Approved" or "Rejected" instead of being changed to "Cancelled") and creating new approval records?

 

Thanks,

Phuong

2 REPLIES 2

Mark Manders
Mega Patron

Can you explain your business requirement? 

Keeping approval records as 'approved' means that you will have records that are formally approved (approval record = approved) but still in 'requested' state. That can lead to very weird combinations of data, not to mention all the (work)flows and rules looking at those. Things will get stuck.


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Hi Mark,

 

My customer want to keep old approval records for audit. They said there must be an audit trail that there was a rejection in this case, then followed by an approval due to some correction/clarification.

 

Until now, I only find one way to create new approval record is that we need to cancel all the existing approval records. Do you have any idea?

 

Thanks,

Phuong