global with sharing class DiscardPxService
This service class provides functionality for discarding documents. Note that only journals and sales credit notes are currently supported.
global static void discardSync(Set<ID> sourceIDs, String discardReason)
This service enables you to discard documents synchronously.
Depending on the type of document that you are discarding, you must have the appropriate custom permission assigned:
JournalDiscard (Discard Journals) to discard journals
SalesCreditNoteDiscard (Discard Sales Credit Notes) to discard sales credit notes
||Identifies the documents to discard. Note that all the IDs in the set must belong to records of the same object. For example, you cannot mix journals and sales credit notes.
||Reason for discarding the documents.