How to Record Payment Using Custom With Below Description

How to Record Payment Using Custom With Below Description

How to Write a custom function to record payments getting the details from the subform of a CRM. Have a reference field (single line) to store a number and push it to the reference number in customer payment. When the function is rerun for the same record after adding one extra record in the subform, it should create only the last record against the invoice. Reference number is key to find if the customer payment is already present or not