Alexander Cuadros
02/01/2024, 3:38 AMrecord.transform
module. However, I'm encountering issues with the date (trandate
) of the payment. It seems to be attempting to use today's date, and the accounting period isn't open yet. I tried passing the value of December 31st to avoid this, but it's giving me an error with that value. Does anyone know why? Has anyone encountered this error before? the code is this: var defaultDate = new Date('12/31/2023');
var fecha = new Date(defaultDate);
// Obtener los componentes de la fecha
var dia = fecha.getUTCDate();
var mes = fecha.getUTCMonth() + 1; // Sumar 1 porque los meses en JavaScript son indexados desde 0
var anio = fecha.getUTCFullYear();
// Formatear la fecha al formato DD/MM/AAAA
var fechaFormateada = (dia < 10 ? '0' : '') + dia + '/' + (mes < 10 ? '0' : '') + mes + '/' + anio;
log.audit("fechaFormateada", fechaFormateada);
log.audit("formattedDate", defaultDate);
var objRecord3 = record.transform({
fromType:'invoice',
fromId: listId,
toType: 'customerpayment',
defaultValues: {
trandate: fechaFormateada} });michoel
02/01/2024, 3:47 AMtrandate
is not one of the valid record initialization parameters you can use as a default value. You need to first initialize the transformed record, and then use record.setValue (for a Date) / record.setText (for a string) to set the date.Alexander Cuadros
02/01/2024, 4:20 AM