This is a migrated thread and some comments may be shown as answers.

PowerField to retrieve Files information

3 Answers 37 Views
Cloud Code
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Mehdi
Top achievements
Rank 1
Mehdi asked on 19 Jan 2015, 11:52 AM
Hi,
I'm trying to add the Files URI when getting data from a related Data type. In the custom data type, I have this and

Everlive.Events.beforeRead(function(request, context, done) {
    request.powerFieldsExpression = {
        "ImageInfo": {
            "queryType": "get",
            "contentType": "Files",
            "filter" : {
                "Id" : "${image}"
            }
        }
    };
    done();
});

returns "ImageInfo: null" in the result.

Can someone help me to add the meta from a file linked to an object?

Thanks

3 Answers, 1 is accepted

Sort by
0
Anton Dobrev
Telerik team
answered on 20 Jan 2015, 02:35 PM
Hi Mehdi,

Thank you for posting to the Telerik Developer Forums.

The "Files" content type is accessed in the following way with a Power Fields expression (note the System.Files) option:
request.powerFieldsExpression = {
    "FileObject" : {
        "queryType" : "get",
        "contentType" : "System.Files",
        "filter" : {
            "Id" : "${image}"
        }
    }
};

Let me know if this helps and if you have questions.

Best regards,
Anton Dobrev
Telerik
 
Everlive is now Telerik Backend Services, and is part of the Telerik Platform.
 
0
Mehdi
Top achievements
Rank 1
answered on 20 Jan 2015, 08:45 PM
Great, that's working perfectly. 

Thank you very much!

You should add the to the documentation ;-)
0
Anton Dobrev
Telerik team
answered on 21 Jan 2015, 03:23 PM
Hi Mehdi,

Glad that this works for you. We will address the issue in the docs as well.

Regards,
Anton Dobrev
Telerik
 
Everlive is now Telerik Backend Services, and is part of the Telerik Platform.
 
Tags
Cloud Code
Asked by
Mehdi
Top achievements
Rank 1
Answers by
Anton Dobrev
Telerik team
Mehdi
Top achievements
Rank 1
Share this question
or