I am using a modified version of the currency conversion script kindly provided in this thread https://community.airtable.com/t5/development-apis/custom-currency-calculations-using-scripting-panel/td-p/136067 by @Vivid-Squid but I don't want to have to run the script each time and select which record I want it to run on. What I'm after is that when I input an amount in the 'Amount (GBP)' field it automatically runs the script to populate the 'Amount (Home Currency)' field.
Any ideas how I do this?
My script looks like this (it basically converts an amount in GBP to equivalent amount in the users local currency):
let table = base.getTable('Currency');
let record = await input.recordAsync('Pick a record', table);
let currencyType = record.getCellValueAsString("Local Currency");
let apiResponse = await fetch(`https://api.exchangerate.host/latest?base=${currencyType}`);
let data = await apiResponse.json();
let conversionRate = data.rates.GBP;
let result = await table.updateRecordAsync(record.id, {'Amount (Home Currency)': record.getCellValue('Amount (GBP)')/conversionRate});
My table looks like this: