Substring name file

I’m trying to subtract the file name and I get this error.
Will it be because of the brackets?
What would be the solution?


1 Like


I’ve seen this error before when calling other JavaScript functions. While it is possible to use JavaScript in the ‘Calculate a value’ option of a variable, not all JavaScript functions will work.

As for a solution, there are two options:

  • The Extract Text activity can do the same thing as the substring function but instead of using the index of the characters, it uses a string value for the start/after and end/before parameters.

  • You could also use the Execute JS Code activity to call the same code you have and set the variable.

Let me know if you have any questions.



In this case. I am using the Extract Text function to remove the brackets and quotes, I try to store it in a variable and now it says that the variable is undefined.

Y también se me presenta este error:

1 Like

It looks like it might be having an issue with the quotation marks in the After and Before properties. You may need to use something like:


I still get the error using calculate the value.

I put it as it is in the above.
After as: “["” (I had put the \ but the forum removes it)
Before as: “/]”"

1 Like

Hi, Jose Miguel. I don’t know if the variable “directory_files” is an array. So, could you try this:

poliza = directory_files[0].substring(0,15);

Or if you are still getting the same error try to split the original string:


This one worked, thank you very much