Help

Re: This expression is not callable

3744 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Access_to_Airta
5 - Automation Enthusiast
5 - Automation Enthusiast

I have a script below to trigger a webhook when a record enters a view. I need to pass two parameters (recordID and UserUuid).

The problem: I get the error message “This expression is not callable. Type ‘string[]’ has no call signatures. (2349)" on the variable userUuid

The possible cause: because variable is Array<string> rather than just string, I need to reflect it in the below code.

I got the script on the internet, so I kindly request if someone could let me know the change to apply in the code to make the array callable?

Thank you so much

let inputConfig = input.config();
// AIRTABLE REALTIME TRIGGER TEMPLATE
let webhook = 'https://hook.us1.make.com/gks2o5k90h0f2fggmdy6u4uilamaegru'
let queryParams = `/?id=${inputConfig.recordID}&user=${inputConfig.userUuid` 
const returnedPayload = await fetch(`${webhook}${queryParams}`);

Screen Shot 2022-11-04 at 10.39.02 am

3 Replies 3

Your Expense Record field is an array (not a string) because it is a linked record field.

The easiest & best thing to do would probably be to just send the RecordID on its own to Make’s webhook, and then use the Airtable - Get A Record module to pull in all the rest of the values from your record, including any array fields like your linked record field.

This is how you would send just the Record ID to a webhook in Make:

let config = input.config();
let url = `https://hook.us1.make.com/xxxxxxxxxxxxxxxxxxxxx?RecordID=${config.myRecord}`;
fetch(url);

Screen Shot 2022-08-04 at 3.05.07 PM

Otherwise, you would need to turn the array into a string. I’m not sure how to do that with Javascript, but you could create a formula field in Airtable that looks something like this: {Expense Record} & ""

This line is missing a closing curly brace after “userUuid”. Adding the missing curly brace may clear up some of the other errors, but the bigger issue is what @ScottWorld pointed out: that field is returning an array.

Assuming that you can trust that there is only one linked record, you can get the record ID from it like this:

inputConfig.userUuid[0].id

In context with the rest of that line, the full line (including adding the missing curly brace) would be:

let queryParams = `/?id=${inputConfig.recordID}&user=${inputConfig.userUuid[0].id}` 

Thanks Scott and Justin,

Your solutions worked great!