Validation on Invoice does not prevent creation of Credit Note Allocation record. Allows multiple unallocation records to be created

Salesforce Billing

Last updated 2019-03-20 ·Reference W-5829111 ·Reported By 3 users

Fixed in version Billing 218.7

Summary
Adding a validation on the Invoice object to prevent unallocation of Credit Note and Debit Note does not prevent the creation of the new allocation records of type unallocate. It prevents the setting of the "Unallocated?" checkbox on the Allocation record that the Unallocation relates to. In addition, a success message of "Payment was Successfully Unallocated" appears.

The math on the Credit Note or Debit Note (and Invoice) is correct, but it can create a situation were the unallocations and allocations are greater than the original amount of the note.

Repro
Set up:
Create field on Invoice (Lock_Invoice_Status1__c in this example) to allow a selection that the invoice is "Locked"
Put a validation on the Invoice object to fire if above field is Locked and the Credits field changes

Step to Reproduce:
Create all steps to create a posted invoice
Create Credit Note/Credit Note Line against that invoice
Allocate it
Go to the Invoice and set the field, Lock_Invoice_Status1__c to 'Locked'
Save

Go to the Credit Note
Allocate
Under your existing Allocations, click Unallocate

Note success message

Note that the Credit Note Line still remains at the bottom unallocated
(this can be repeated and additional records created)

Cancel out of the Visualforce page and note also that the prior Allocation record of Type Allocation does not have the Unallocated? checkbox checked.

Workaround
Do not use an object validation on Invoice to prevent allocation and unallocation records to be created.

Any unreleased services, features, statuses, or dates referenced in this or other public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make their purchase decisions based upon features that are currently available.