The following script uses the redirect.toRecordTransform method to convert an invoice into a customer payment:
redirect.toRecordTransform({
fromType: record.Type.INVOICE,
fromId: invoiceId,
toType: record.Type.CUSTOMER_PAYMENT,
parameters: {
"record.paymentoption": paymentoptionId,
"record.custbody_grw_026_invo_account": accountId,
"record.iswiretran": "T",
}
});
Key Components
fromTypeandfromId: Specifies the source record type (invoice) and its ID.toType: Indicates the target record type (customer payment).- Parameters:
"record.paymentoption": Sets the payment option."record.custbody_grw_026_invo_account": Associates the payment with the account."record.iswiretran": Marks the payment as a wire transfer. This parameter is accessible in this within user event scripts.