Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

ERROR "no such property: filename for class: java.lang.object"

Rafael Costa
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 7, 2022

I'm trying get a csv attachment then get values. I found the script below on this forum, but I give this error when I try run:

GROOVY ERROR.png

 

Someone help me to fix it?

1 answer

1 accepted

0 votes
Answer accepted
Tuncay Senturk _Snapbytes_
Community Champion
March 7, 2022

Hi @Rafael Costa 

 

Can you please try filename (with lowercase 'n')?

def filename = attachment.filename
Rafael Costa
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 15, 2022

I keep searching and the correct should be attachment.getFilename()

Tuncay Senturk _Snapbytes_
Community Champion
March 15, 2022

Hi,

Both will work,

Groovy accepts class.propertyname as well as class.getPropertyname()

here the property name is filename, not fileName. In your attached image it was fileName which would give a compiler error.

Suggest an answer

Log in or Sign up to answer