Help

Automation Script Returning Successful But Not Doing Anything

Topic Labels: Automations
454 0
cancel
Showing results for 
Search instead for 
Did you mean: 
erwaggoner
4 - Data Explorer
4 - Data Explorer

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);

 

 

0 Replies 0