-1

What is the correct reference for the Note entity when using OData? I'm trying to use OData SDK.jquery.RetrieveRecord function to query the Note entity (schema name "Annotation") however I get error message "Error : 404: Not Found: Resource not found for the segment 'AnnotationSet'.

Here is the code I'm using. productID is a GUID and "abpm_producto_Annotations" is the 1:N relationship.

SDK.JQuery.retrieveRecord(productID, "Annotation", "abpm_producto_Annotations", null, function (result) {
    if (result != null) {
        //A note is attached
    }
},
    errorHandler);
maatthias
  • 137
  • 2
  • 12

1 Answers1

0

I'm not familiar with that particular JavaScript SDK, but I'm assuming you are using this one: http://msdn.microsoft.com/en-us/library/gg309549.aspx#BKMK_SDKJQueryJS.

The retrieveRecord record looks up a record by its CRM ID, but it appears that you are looks like you are looking up a note (Annotation) by a product ID.

You likely want to construct the query using something similar to the following:

SDK.JQuery.retrieveRecord(productID, "Product", "abpm_producto_Annotations", null, function (result) {
if (result != null && result.abpm_producto_Annotations.length) {
    var firstNote = result.abpm_producto_Annotations[0];
}

}, errorHandler);

You may want to use the ODATA Query Designer from the Dynamics Xrm Tools product to make sure you have the correct relationship name.

BlueSam
  • 1,888
  • 10
  • 17
  • Yes that is the library I'm using. I'm using SDK.JQuery.retrieveRecord to see if there are any related notes (not Product entity). – maatthias Jul 17 '14 at 19:39
  • I confirmed with OData Query Designer (thanks!) that the entity set is indeed called "AnnotationSet". So I'm a bit stuck here. – maatthias Jul 17 '14 at 19:51
  • Did you understand my comment about your attempt at getting an annotation (note) by a product id? What you want to do is retrieve the product, but select and expand the note relationship of the product. – BlueSam Jul 21 '14 at 21:47