Help

Re: How can a Scrip run when pressing in another website?

1244 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Omer_Rugi_Hay
4 - Data Explorer
4 - Data Explorer

Hello,
I’m using pory.io and I tried to implament a “like” system in my table - a button with script that when pressed it increments "“likes” col in the row it has been pressed.
But when using the button in pory.io it sends me to the table and opens the row details.
The code:

const config = input.config({
    title: 'Add 1 to a number field',
    description: 'A script that lets you increment a number',
    items: [
        input.config.table('table', {
            label: 'Idea Table',
        }),
        input.config.field('numberField', {
            label: 'Likes',
            parentTable: 'table',
        }),
    ]
});
const record = await input.recordAsync("Pick a record", config.table)
const currentNumber = record.getCellValue('Likes');
const newNumber = currentNumber ? currentNumber + 1 : 1
await config.table.updateRecordAsync(record, {
    [config.numberField.name]: newNumber 
})
output.markdown(`Updated ${config.numberField.name} for ${record.name} to ${newNumber}`)

1 Reply 1
Joe_H
Airtable Employee
Airtable Employee

Welcome to the community Omer!

While the script itself looks good, Script Apps have to be run in the client of an open base – Airtable does not allow buttons connected to Script Apps to be used outside of the client base (other button actions like opening a URL can be used).

A work around here may be to use a Single select field to trigger an Automation with a script action.

One final thought – I am no expert with pory.io, but if your use case is to create a more customized front-end interface, you may want to check out Interface Designer – a recently launched feature that allows you to create multiple interfaces on top of a base.

**Note: Interface Designer has the same limitations involving buttons with a script action.