PowerField to retrieve Files information

4 posts, 0 answers
  1. Mehdi
    Mehdi avatar
    2 posts
    Member since:
    Nov 2013

    Posted 19 Jan 2015 Link to this post

    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
  2. Anton Dobrev
    Admin
    Anton Dobrev avatar
    539 posts

    Posted 20 Jan 2015 Link to this post

    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.
     
  3. Mehdi
    Mehdi avatar
    2 posts
    Member since:
    Nov 2013

    Posted 20 Jan 2015 in reply to Anton Dobrev Link to this post

    Great, that's working perfectly. 

    Thank you very much!

    You should add the to the documentation ;-)
  4. Anton Dobrev
    Admin
    Anton Dobrev avatar
    539 posts

    Posted 21 Jan 2015 Link to this post

    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.
     
Back to Top