hclleapforum

Open full view…

How can I know that an object is an attachment or another specific type?

technologirl
Tue, 28 May 2019 14:28:03 GMT

I'm printing a table that has some attachments and I want to distinguish when I have to create the link to the file and when not, thanks!

Rob Lintern (HCL)
Tue, 28 May 2019 15:17:02 GMT

if (value !== null && typeof value === "object" && value.fileName) { // looks like an attachment }

Rob Lintern (HCL)
Tue, 28 May 2019 15:51:27 GMT

I'm not sure in what context you are writing your code, but you may also be able to use the getType() function: if (item.getType() ==="attachment") { // this item is an attachment } Reference: http://leap.hcldoc.com/help/topic/LEAPv9/LEAP/ref_jsapi_user_interface_objects.html