Help

Error in inputConfig

Topic Labels: Automations
488 1
cancel
Showing results for 
Search instead for 
Did you mean: 
Stephs
4 - Data Explorer
4 - Data Explorer

I'm having problems with inputConfig. I'm running a script to check if there are fields with missing data in the columns, this script sends me a notification with which data is missing and generates a report, but I came across this error:

Stephs_0-1688666629072.png

The script I want to run in this automation is this:

const table = base.getTable('NOME_DA_TABELA');
const columns = table.fields;

// Função para verificar se um valor está vazio
function isEmpty(value) {
return value === undefined || value === null || value === '';
}

// Variável para armazenar os nomes das colunas com dados faltando
let missingColumns = [];

// Verificar se há dados faltando nas colunas
for (const column of columns) {
const value = inputConfig.newRecord.getCellValue(column);

if (isEmpty(value)) {
missingColumns.push(column.name);
}
}

// Enviar uma notificação e gerar um relatório se houver colunas com dados faltando
if (missingColumns.length > 0) {
const recordUrl = inputConfig.newRecord.getRecordUrl();
const reportText = `Novo registro com dados faltando:\n\nURL do registro: ${recordUrl}\nColunas com dados faltando: ${missingColumns.join(', ')}`;

output.set('subject', 'Dados faltando em um novo registro');
output.set('text', reportText);
output.set('report', reportText);
}

 

How to solve? Can you help me?

1 Reply 1

Where did you get this script? Can you ask the script writer? 

inputConfig is usually a user created variable for object returned by input.config(). It looks like this is not properly declared in your script. It should not be declared inside a loop. The script also seems to be missing a query for the actual record.