Skip to main content

Automation Script Returning Successful But Not Doing Anything

  • January 29, 2024
  • 0 replies
  • 9 views

erwaggoner
Forum|alt.badge.img+1

Having a strange issue where my automation script reports successful and appears correct, but doesn't actually do anything. It's a fairly simple when record is created update the record fields from an API call.

I've attached the script below, fairly new to Airtable and JS, although not to coding in general.

Any help is appreciated!

 

 

let table = base.getTable('Cards'); let inputConfig = input.config(); let apiResponse = await fetch('https://api.pokemontcg.io/v2/cards/' + inputConfig.updateId); let info = await apiResponse.json(); let setAll = [ info.set ]; let setImg = [ setAll.images ]; let imgAll = [ info.images ]; let tcg = [ info.tcgplayer ]; let cm = [ info.cardmarket ]; let recordToUpdate = inputConfig.cardId; await table.updateRecordAsync(recordToUpdate,{ 'Name': info.name, 'Supertype': info.supertype, 'Types': info.types, 'Set Name': setAll.name, 'Series': setAll.series, 'Set Symbol': setImg.symbol, 'Set Logo': setImg.logo, '#': info.num, 'rarity': info.rarity, 'natNum': info.natNum, 'image': imgAll.img, 'imagesmall': imgAll.imgSm, 'TCG ⧉': tcg.tcgUrl, 'Cardmkt ⧉': cm.cmUrl, }) console.log('Updated record ' + inputConfig.cardId);