$Label error on receipt preview or usage

$Label error on receipt preview or usage

If you are seeing an error that is similar to the above, then you need to locate the receipt email template and edit it.

The receipt email template is under setup > Communication Templates > Email Templates.  Select Folder Payments2Us, then click into "Payment Receipt", followed by the edit button.

Look for the line that begins with "<messaging:attachment".  Replace this with the

<messaging:attachment renderAs="PDF" filename="{!NULLVALUE(relatedTo.AAkPay__Payment_Setting__r.Document_Type__c,$Label.AAkPay__Receipt_Label)} {!RelatedTo.AAkPay__Receipt_Number__c}.pdf">

We have not been able to identify why Salesforce sometimes seems to change the $!label.Receipt_Label to a number field.  This error can occur after a template is edited or after an upgrade.

If you find for some reason this issue keeps on appearing, then you can replace the code with the following instead:

<messaging:attachment renderAs="PDF" filename="Receipt {!RelatedTo.AAkPay__Receipt_Number__c}.pdf">