Discussões

Criar Tabela de faturamento particular vinculada ao Pedido de venda existente usando SuiteScript 2.0

editado Jun 2, 2025 2:37PM Dentro SuiteCloud / Personalização

Aplica-se a

Produto:  NetSuite 2024.2

Cenário

Um script de Evento do usuário do SuiteScript 2.0 que cria uma Tabela de faturamento privada vinculada a um Pedido de venda existente.

Solução

Num Script de Evento do Usuário implementado nos registros do Pedido de venda, o código de exemplo abaixo pode ser executado no ponto de entrada após o envio em um Pedido de venda existente:

if(context.type == context.UserEventType.EDIT){

var recordId = scriptContext.newRecord.getValue({
fieldId: "id" // get internal Id of the current sales order
})

var billingScheduleRec = record.create({
type: 'billingschedule',
isDynamic: true //create a billing schedule record
});

billingScheduleRec.setValue({
fieldId: 'name',
value: 'BlilingSchedViaScript' //set the name of the billing schedule record
});

billingScheduleRec.setValue({
fieldId: 'initialamount',
value: 2 // set the initial amount field
});

billingScheduleRec.setValue({
fieldId: 'numberremaining',
value: 2 // set the number remaining field
});

var frequencyField = billingScheduleRec.getField('frequency');
var frequencyOptions = frequencyField.getSelectOptions(); //get the list of frequency options

billingScheduleRec.setValue({
fieldId: 'frequency',
value: frequencyOptions[2].value //set the frequency field this is weekly
});

billingScheduleRec.setValue({
fieldId: 'ispublic',
value: false // set the public checkbox to false
});

billingScheduleRec.setValue({
fieldId: 'transaction',
value: recordId // set the transaction field to the current sales order internal Id
});

var billingSchedId = billingScheduleRec.save({
enableSourcing: true,
ignoreMandatoryFields:

Olá, bem-vind@!

Faça login

Para ver todos os detalhes, faça o login.

Cadastre-se

Não tem uma conta? Clique aqui para começar!

Ranking

Gênio da Comunidade

1º Trimestre (Jan-Mar 2026)

Líderes desta semana

Líderes deste mês

Líderes de todos os tempos