record.create is not supported for customer paymen...
# ask-stanley-ai
p
record.create is not supported for customer payment record, what are the other options
c
AI generated answer (using internal Slack threads):
****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ****** The
record.create
method is indeed not supported for the Customer Payment record in SuiteScript. However, there are alternative ways to handle this situation: 1. Transforming an Invoice to a Customer Payment: You can use the
record.transform
method to transform an Invoice record into a Customer Payment record. This is a straightforward approach and mimics the 'Accept Payment' button in the NetSuite UI. Here is a sample code snippet:
Copy code
javascript
var customerPayment = record.transform({
    fromType: record.Type.INVOICE,
    fromId: invoiceId,
    toType: record.Type.CUSTOMER_PAYMENT,
    isDynamic: true,
});
2. Handling Bank Charges: If you're trying to record fees in the Customer Payments, you could assign the payment to the invoice, then journal the difference to a P/L bank charges account. Alternatively, you could create a service item 'Bank charges' and post the sales to bank charges. Raise a credit memo using this item with the value of the bank charges. This will then credit the A/R account with the value of the bank charges and debit P/L. The payment and the credit note could then be applied to the invoice to clear it completely. Remember to always test your scripts in a sandbox environment before deploying them to production.
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.837355077
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.816445649
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.810952842
Please provide your feedback on this answer.