Writable Input Variables

Hello! I’m attempting to dynamically pass data through an API with the utilization of an Airtable button that triggers a ‘Run Script’ Automation. Essentially, the script will take the email of the record which triggered the automation, pass it through the API and the rest is covered.

My biggest challenge is that I need to encode the email value in the API URL, however, I cannot figure out a way to modify the ‘readonly’ attribute of the input variable I’m attempting to use in this case.

Anyone know of a method to bypass the ‘readonly’ attribute? Or if you have a different solution to get the records email in the script, I’m all ears!

Code for reference:

let email = input.config();
var encodedEmail = encodeURIComponent(email);

fetch(“https://api.sendinblue.com/v3/contacts/” + encodedEmail + “”, options)

You are not using input.config() correctly.
Click the “learn more” link in the left side of the automation script editor for an example on how to use input.config() in the documentation. You also need to setup your input variable.

Hey Kuovonne, thanks for your feedback.

I didn’t share the details of it, but the input variable is setup to pull the email from the specified record that triggered the automation.

I checked out the ‘Learn More’ documentation before posting to this thread as it didn’t really make much sense to me. I’d appreciate if you could further elaborate on how to properly utilize input.config()!

Also attempted this line of code, var email = (input.config().readonly=false); - but was also unsuccessful.

What is your coding background?

Most proficient in JS.

input.config() returns a JavaScript object that contains the input variables defined in the left section of the script editor. It does not return the triggering record.

You can put the field value in an input variable.

Or you can put the record ID of the triggering record in an input variable, and query for the record. You should also know that once you get the record object, the field values are not stored as properties of the object.