Cannot read property "length" from null

GD11
Tera Expert

I have written a script to find some specific content from all HTML fields from knowledge articles but getting below error when there is not specific data in one of the field, not sure what should I write so that it can run only when there is at least 1 matching record in 1 of the HTML field. 

 

GovindDhande_1-1664916255101.png

 

6 REPLIES 6

The syntax I know and have used for years is gr3.<field_name>. I see no way that 'str = gr3[txt]' would return anything valid.  Please comment out the line that produces an error and see what your 'gs.print("data in field" + str);' shows.

Bert_c1
Kilo Patron

Also, the line that initializes 'var regex' should probably use values enclosed in quotes. And you may have to "escape" some. I don't practice regex.