Help

Re: Script that types "(A word)" into {FieldX} within the record

1049 1
cancel
Showing results for 
Search instead for 
Did you mean: 
Joe_Pino
6 - Interface Innovator
6 - Interface Innovator

Hey all,

I have a button that “Runs script”. I want the script to type "(a word)" into {FieldX}, obviously in the same record as the button that was pressed

Thank you!

7 Replies 7
Noor
6 - Interface Innovator
6 - Interface Innovator

Hi @Joe_Pino i can help you about that.But your description is not clear.If you need personal assistant please feel free to mail me

Given this table …

image

The script would look like this:

/*
   ***********************************************************
   Airdrop - Button Action
   Copyright (c) 2020 by Global Technologies Corporation
   ALL RIGHTS RESERVED
   ***********************************************************
*/

// display the title
output.markdown('# Button Action');

let table = base.getTable("Button Action");
let record = await input.recordAsync('Pick a record', table);

// update the execution status
await table.updateRecordAsync(record, {
   "Field X" : "(a word)"
})

@Bill.French Bill! Thank you sir.

Now additionally is there a modification of that script that could use variables for record and table? I apologize that both these questions are likely overly general but if you can understand where my heads at it seems like you’d understand lol. Thanks again!

Yes, that’s why they call it programming. :winking_face: Pretty much anything you might imagine is possible in Airtable with javascript. The bigger challenge is knowing precisely what you want and conveying that vision to people who can make it a reality.

In a script, any table can be dynamically chosen or statically selected. The same applies to target fields within tables and data to be read from or written into those fields.

For this component, what do I put so the script itself doesn’t require me to input each table name? (Even though your first thought would be to avoid cloning tables, and instead add a linked record in a single table to essentially combine multiple tables into 1)

Going off of that, what about this part?

What do I put into quotations?

Also this part,

What variables could I put so the record referred to is always the one directly to the right of the script button field?

Lastly,

For this part, although the text can always be the same, I suppose the name of the Field (“Field X”) can be the same across tables, but just want to confirm that.

To give you context of what I am doing at a high level, I want to have a structurally identical table for each client, which I provide them a shared view for. From shared views, the only thing toggleable are buttons, not checkboxes, not multi-select fields, only buttons. I essentially have a button that when the client clicks, triggers a webhook that ultimately sends them an invoice and bills them. However, for that button that invoices them, I want to make that button itself a confirmation button, and have it disabled using an IF statement that reads "IF({Field X=“Yes”, “zapier-webhook-url…”). Then, the button I want to “Run Script” essentially prints “Yes” into Field X so that the confirmation/Webhook with Label “Confirm” will be clickable. So, each client has a table with the same fields, including these 3, for the Script button, the Field X field which needs “Yes” printed into it, and the confirm button itself which is the one that triggers the webhook.

I always appreciate your Support @Bill.French ! I am probably testing your patience with my lack of knowledge around scripting/code so thank you for your support. Thank god the no-code space exists!

LOL. Yes, you are. I’m slammed with work so a bit distracted. My job is pretty much done here - I’ve led you to the edge of the volcano and you are ready to begin building something, but you’ll need other guides and they are here, but you need to read the Airtable SDK documentation and this assignment will answer some of the questions above. For example, the second question is addressed right here.

I recommend you explore and find the brick walls and then reach back into the community with specific issues to get quick responses to questions.

Thank you! Keep up the hard work @Bill.French :laughing: