Solved

Can someone explain to me what is happening with this Javascript snippet in the workflow?

  • 29 August 2022
  • 6 replies
  • 56 views

Userlevel 3
Badge +10

What I am doing here is using the javascript subscript method to get a character to use in a switch statement.

I noticed the switch statement is always going to default so I stuck a logger.info snippet into the workflow and apparently substring is returning a number instead of a character.

 

 

 

 

Clearly I am doing something wrong. 

Halp.

icon

Best answer by chrisknows 29 August 2022, 18:02

View original

6 replies

Userlevel 3
Badge +10

Ugh. It’s busted.

Userlevel 3
Badge +10

Ok it looks like what is happening is that is the clientName/clientName is not being treated as a string. 

 

 

Userlevel 7
Badge +23

Hey @chrisknows , let me see if I can get some internal folks to chime in.

Userlevel 3
Badge +10

You can close this one. 

It’s returning a lowercase “L” which I thought was a one.

 

The mistake I was making was zero based index vs 1 based index. 

I realized when tried doing clientName[3] instead of using substring.

It worked when I did clientName[2], I wanted the third character in the string, but of course for a zero based array that is the second element not the third.

 

Silly errors wasting time.

 

Userlevel 7
Badge +23

That’s gotta be the 3rd or 4th time you solved your own issue 🤣

Figures that the only one who could fix an issue you had is….well, YOU!

glad you got it cracked!

Userlevel 3
Badge +10

Sometimes all I need is a sounding board. 

Working from home alone has it’s downsides 😂

Reply