Help

Save the date! Join us on October 16 for our Product Ops launch event. Register here.

Re: automation to resize images. Can't pass record to script

363 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Tanguy_Auffret-
6 - Interface Innovator
6 - Interface Innovator

Hey everyone.
I am trying to use the script made by No Code Collab that is made to run as an extension with a button trigger and turn it into an automation that runs a script.
I cannot figure how to pass the record to the script. 
I have set up my input variable but cannot find a way for the script to take it into account.
in the screen shot you can see what I have tried without any success
Any ideas ?
Thanks !
T

2 Replies 2
PedroCerrano
6 - Interface Innovator
6 - Interface Innovator

Good morning!

On line 15, you initialized the input config with a "let" named "recordID." Now you have to drill down into that config with the "." (dot) syntax to access the value in it. In your case, you've called it "my record ID." Make sense?

I would recommend rewriting line 15 like this:

 

const input = await input.config()

 

And then to rename your input variable to: 

 

recordID

 

From there, you should be able to access the variable like this:

 

input.recordID

 

Hi,
you can't receive record, but you can get record id.
when you use input.config(), it contains all input variables.
don't use space in variable name
to get record by its id, you should query table like this

let record=await table.selectRecordAsync(recordID)

to avoid all this stuff with querying record and then record.getCellValue('Field'), you can add values directly in a list of input variables,
for example you have value1 in Field1 and value2 in Field2 and added them to the list at left side
you can directly assign them by 

let {recordID,value1,value2}=input.config() //names must match input variable names

But i'm not sure how it is working with Attachments

Instead of output.text, use console.log
Instead of remoteFetchAsync, use fetch (sometimes it doesn't work)