Help

Re: Scripting Problem with Input Variables

3903 1
cancel
Showing results for 
Search instead for 
Did you mean: 
Rose_Haft1
8 - Airtable Astronomer
8 - Airtable Astronomer

Hi there - When I copy and paste the sample code for my input configuration, I am receiving this error and the code won’t run.

‘iv_UpdateStatus’ does not exist on type ‘{}’.(2339)

Any suggestions on what could be wrong? Or how to fix it?

23 Replies 23
Rose_Haft1
8 - Airtable Astronomer
8 - Airtable Astronomer

In this case, I have indicated the only code in the script is the copied code. There is nothing else and it’s still causing an error.

image

I apologize for offending you. That was not my intent. There are many people with a wide range of coding abilities who post on these forums.

I have deleted my previous post in this thread per your request. It clearly was not helpful for you anyway.

Thank you for posting the screen capture and explaining that you have successfully used input variables before. Both pieces of information may be useful to anyone interested in helping you troubleshoot this issue.

Hi @kuovonne - Do you have any indications on what is causing the error with the sample code?

Yes, I am aware there are people with many different backgrounds. Most of my questions are in regards to the first time using the product, which there isn’t always great documentation for.

In this case, I am using sample code, like I’ve done in the past, and it’s not working.

Any help would be appreciated.

I do not know what is causing the error with the code. Automation scripts have many moving parts and even with a screen shot, there are things that may be difficult to diagnose. Based on your screen shot, I have several troubleshooting tasks that I would use to gain more information, if I were experiencing the results that you are seeing. However, the first thing I would try would be the suggestion that I made in my previous (now deleted) post that offended you.

It appears the paste operation may have injected quotes that are incompatible with the javascript engine. My money is on the copy-paste - not the code.

I don’t think it is a copy-paste error. The quotes look correct in the screen shot. The color coding in the screen shot also make me thing it is not a problem with quote type. (@Bill.French, I’m curious how much you’d wager, but I’m not the gambling type or I would already have a fine sandwich.)

The text is also copy/pasted from the documentation (which cleverly adapts to the base, including whatever input variables are created). When Airtable created this documentation, the programmers took care to make sure that the code could be copy/pasted (note the “copy” button in the corner of the documentation.

The fact that the documentation is copied also makes it highly unlikely that it is a spelling error, or that there are stray/hidden space characters in the input variable name. I would still like to see what a console.log of inputConfig by itself would be, but I suspect that it would be an empty object.

It also isn’t clear what the comment “the code won’t run” means. For example, is the “Test” button disabled? Or is the “Test” button enabled, but there is no obvious output when the button is run? Or is the automation on, but not getting triggered? Or is the automation on and triggering, but throwing an error?

I bet that the error reported in the initial post comes from the code editor–not from actually running the script. I sometimes get the wavy red underlines on code that I know will work, and the code editor has recently been more zealous in handing out wavy red underlines, so I don’t always trust them to be actual problems.

The screen capture also has a slightly different icon with the value for the input variable from what my screen shows. This may be just a matter low resolution in the screen shot, or it may indicate that we somehow have different versions of code running.

I’ll run the risk of offending again, and suggest my troubleshooting tips, as basic as they are …

  • Try console.log() of the variable that isn’t giving the expected value. If that doesn’t work, try console.log of an earlier variable. In this case, if console.log of one of the properties of inputConfig doesn’t give the expected result, try console.log of the variable itself.

  • Retest every previous part of the automation, including the trigger. Make sure that the test of all the previous steps are successful.

  • Restart Airtable / restart the computer. While it is restarting, have a snack, a drink, and possibly a nap. I’m always surprised when having a snack, a drink, and a nap solve my coding problems, but they have on multiple occasions (even when the drink isn’t alcoholic).

That’s way too much to write without seeing the code. :winking_face:

We do see the code in the screen capture. There is a lot of information in the screen capture, although I wish the screen capture had not been cropped as tightly. For example, the test output area and the test button itself have been cropped out; those two things could have provided additional useful information which may have caused me to rearrange my troubleshooting steps.

On the other hand, perhaps you are thinking my post is too much to read?

You may also be missing part of the conversation. I deleted one of my posts when Rose requested that I edit my comment, and she has also deleted one of her posts and edited another post.

For me, analyzing code is already a bit challenging; adding a level of speculation just makes it that much more time-consuming. In this case, the code is a freely-available sample, so why not share the entirety of code so that there’s no speculating required? I once saw a team of three people waste a week trying to understand that copied and pasted characters can create encoding issues that are invisible.

I’ll bet that when the cause is determined, it’ll be simple, obvious, and likely remedied in minutes.