Unable to return FileDocument from Java Action.

0
I have created a Java action and set its return type to FileDocument, but in code mendix set the return type IMendixObject. because of this when i return an object of FileDocument it is compilation error of can not convert from FileDocument to IMendix Object. Please Help! I just wants to write a string in a fileDocument and pass it to REST API request.
asked
2 answers
3

You should be working with an entity that is a generalisation of a FileDocument. In your Java Action call the getMendixObject() method on the proxy class for that entity to get a suitable object to use in the return statement.

https://docs.mendix.com/howto/data-models/working-with-images-and-files/#1-introduction

Hope this helps.

answered
4

In Java in the return statement you can just do:

return fileDocument.getMendixObject();

 

answered