CrmRestKit - Create - QuoteDetail

Answered CrmRestKit - Create - QuoteDetail

  • Wednesday, 2 May, 2012 12:31 PM
     
     

    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


    Ernest Geyskens

All Replies

  • Wednesday, 2 May, 2012 9:01 PM
     
     Proposed Answer
    Please use daniel cai javascript tool kit
    http://danielcai.blogspot.com/2010/01/crm-web-service-javascript-toolkit.html
    It works perfect in your case. Its essay to use

    I hope this helps. If my response answered your question, please mark the response as an answer and also vote as helpful.
    Mubasher Sharif
    Check out my about.me profile!
    http://mubashersharif.blogspot.com
    Linked-In Profile
    Follow me on Twitter!

    • Proposed As Answer by MubasherSharif Wednesday, 2 May, 2012 9:01 PM
    •  
  • Thursday, 3 May, 2012 7:21 AM
     
     Answered

    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'); });


    Ernest Geyskens