Help

Auth0 Log In action Create Record in Airtable

Topic Labels: API
1082 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Maca_from_Avoca
4 - Data Explorer
4 - Data Explorer

I am trying to create a record on airtable and I am getting that createdRecords is “undefined”.

All the variables FirstName,LastName,Email,JobLevel print to console but then createdRecords is undefined.

const Airtable = require('airtable');
var base = new Airtable({apiKey: 'VARIABLE'}).base('VARIABLE');
const table = base('VARIABLE');

  var FirstName = event.user.given_name;
  var LastName = event.user.family_name;
  var Email = event.user.email;
  var JobLevel = event.connection.id;
console.log(FirstName,LastName,Email,JobLevel);

const createdRecords = await table.create([
            { fields: {FirstName, LastName, Email, JobLevel} }, 
        ]);
console.log(createdRecords);

This is all part of auth0 post login action that looks like this

exports.onExecutePostLogin = async (event, api) => {
const Airtable = require('airtable');
var base = new Airtable({apiKey: 'VARIABLE'}).base('VARIABLE');
const table = base('VARIABLE');

  var FirstName = event.user.given_name;
  var LastName = event.user.family_name;
  var Email = event.user.email;
  var JobLevel = event.connection.id;
console.log(FirstName,LastName,Email,JobLevel);
const createdRecords = await table.create([
            { fields: { FirstName, LastName, Email, JobLevel} }, 
        ]);
console.log(createdRecords);
};
0 Replies 0