Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Retrieve a List of Images from a related Entity.

Posted on by Microsoft Employee

Hi there, I need some help putting together an odata query in my javascript using REST, to get some related image data.

I have an entity named Cast.  I have a second entity named CastImages.

Each CastImage entity has a CastId.

I am writing a webresource that retrieves the list of images for me but I am struggling with the query that I need in CRM.

For a given CastId, I want to retrieve a list of the related images in the related CastImages entities.

So far I have this but I am stuck on how to retrieve the images.

//this is the Cast entity id

var regardingObjectId=window.parent.Xrm.Page.data.entity.getId();     
var entitySchemaName="CastImages";
var odataQuery = "?$select=EntityImageId&" +  
                    "$filter=ObjectId/Id eq guid'" + regardingObjectId;

   //call retrieveMultipleRecords method in SDK.REST javascript script library  
   SDK.REST.retrieveMultipleRecords(entitySchemaName, odataQuery, getPropertyImagesCallback, function (error) { alert(error.message); }, function(){});

How do I also retrieve the image data with this query?  In fact how do I retrieve the Image data at all even just for one EntityImageId?

*This post is locked for comments

  • Suggested answer
    Mahendar Pal Profile Picture
    Mahendar Pal 45,095 on at
    RE: Retrieve a List of Images from a related Entity.

    How you are storing your images in CastImages under notes right ?? I hope you can bring that data with your odata query using expend method which allows you to get data from related entity. refer: http://himbap.com/blog/?p=868

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Retrieve a List of Images from a related Entity.

    Thanks Drew I got it figured out in the end, thanks for your help

  • Verified answer
    Drew Poggemann Profile Picture
    Drew Poggemann 9,079 on at
    RE: Retrieve a List of Images from a related Entity.

    Sorry about that...   The only other resource that looks like it might be helpful is this:  dynamicscrmgirl.wordpress.com/.../crm-2013-javascript-update-an-entity-image-of-a-record-using-odatarest-endpoint-without-jquery

    hopefully this helps...

    Thanks,

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Retrieve a List of Images from a related Entity.

    Hi Drew and thank you for your reply.  That is retrieving images from a notes field, which I can do, and the solution unfortunately isn't using OData which I require.

    I am using the CRM SDK

  • Suggested answer
    Drew Poggemann Profile Picture
    Drew Poggemann 9,079 on at
    RE: Retrieve a List of Images from a related Entity.

    I think this old article will help...  stackoverflow.com/.../how-to-query-for-image-saved-in-records-annotation-using-javascript-in-crm-onlin

    Thanks,

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans