Help

Scripting Problem with Input Variables

Topic Labels: Scripting extentions
3478 23
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.

I agree.

I don’t think that I am speculating that much. Rose has stated that she simply copied the code from the sample and did not add or alter the code. She shows the sample in the screen capture, along with the copy button. I have also used that copy button with no ill effects or weird characters.

I believe that she has shared the entirety of the code in the screen capture. You can see it twice: once in the code editor and again in the documentation.

I hate editing text with invisible characters. You may be right that it is an issue of hidden characters. But I still doubt that it is an issue of quote characters copy/pasting incorrectly.

I agree that the solution will probably be something simple and likely remedied in minutes. However, I’m not so sure that the cause will ever be determined.

Hi @kuovonne and @bill.french -

Below is the code. The ‘it won’t run’ is coming from the blue Test button being greyed out.

There is an error in the variables box (red suiggly line) with some of the variables but not all of them. Are there rules about what the variables can and cannot contain?

let inputConfig = input.config();

console.log(The value of iv_date_created is ${inputConfig.iv_date_created});

console.log(The value of iv_NameModified is ${inputConfig.iv_NameModified});

console.log(The value of iv_UpdateAssignedTo is ${inputConfig.iv_UpdateAssignedTo});

console.log(The value of iv_UpdateDueDate is ${inputConfig.iv_UpdateDueDate});

console.log(The value of iv_UpdateDoDate is ${inputConfig.iv_UpdateDoDate});

console.log(The value of iv_UpdateStatus is ${inputConfig.iv_UpdateStatus});

Have you retested every step of the automation in order, starting from the trigger?

@Bill.French and @kuovonne - Is it possible that there is an error because it’s a time variable?

I am not sure what the limits of the input variables are.

I deleted all but one variable, and re-copied and pasted to simplify. When else have you seen this be problematic?

image

Can you show a screen capture of the automation configuration page that shows the trigger and all of the steps in the automation?

Can you also please answer the question regarding retesting all of the steps in the automation? (And if you have not retested all of the steps in the automation, can you please do so?)

Thanks. One of the challenges with script automations that lean on historical process steps is that those steps are blind to the troubleshooter. Perhaps you should create a base that includes a sample record such that the complete process can be reviewed. Then share it to @kuovonne.

With that, a snapshot of the contents of the inputConfig object would also be really helpful because it appears you are referencing input elements that simply don’t exist.

@Bill.French I see two issues here, and it isn’t clear if they are related or not.

  1. The script will not run. This probably has nothing to do with the code itself.
  2. The editor is complaining that inputConfig is missing some properties.

In my experience the two issues are not related.

Here is the sample base: Sign up - Airtable

The flow is:

Name field is updated
Last modified time field is updated
Automation runs

The automation is not running for the time update nor the name update on their own and also not together.

Thanks in advance for your help.

Runs fine for me -

image

Enabled the automation in the base, changed the name field - ran as expected -

image