CrmRestKit - Create - QuoteDetail

May 2, 2012 at 8:43 AM

Hello,

I try to create a QuoteDetail with CrmRestKit.Create but it never work.

Here my code:

       oRecordTest = {
        QuoteId: { Id: '{4C0396B3-21FA-E011-B736-0050568E5263}', LogicalName: 'quote' },
        ProductId: { Id: '{25FBEEF8-9625-4210-B1AD-E4162D75F0B0}', LogicalName: 'product' },
        UoMId: { Id: '{E42F91D7-CCED-E011-AB2C-00215A49C424}', LogicalName: 'uom' },
        Quantity: { Value: 1 },
        ManualDiscountAmount: { Value: 0 }
       };
       CrmRestKit.Create('QuoteDetail', oRecordFree, false)
        .fail(function (xhr, status, ethrow) { alert('not created: ' + status); } )
        .done(function (data, status, xhr) { alert('created'); });

Also I can't get a good error message.

If someone have an Idea ?

Thank you in advance,

Ernest Geyskens

May 3, 2012 at 8:23 AM

Thank to Daniel René Thul, now it work.

Source Code:

oRecord = {
   QuoteId: CrmRestKit.EntityReferenceFactory(gParentId),
   ProductId: CrmRestKit.EntityReferenceFactory(gProductId),
   UoMId: CrmRestKit.EntityReferenceFactory(gUomId),
   Quantity: '1.0000000000'
};
CrmRestKit.Create('QuoteDetail', oRecord, false)
.fail(function (xhr, status, ethrow) { alert('Error: ' + status + ': ' + xhr.statusText + '.'); } )
.done(function (data, status, xhr) { alert('created'); });