locked
Silverlight SalesOrder Issue RRS feed

  • Question

  • I am getting the following error when trying to create a salesorder from a quote:

    "Attribute customeridtype must not be NULL if attribute customerid is not NULL"

    I am using the following code and don't know how to set this attribute:

     

     SalesOrder sOrder = new SalesOrder();
                    sOrder.QuoteId.Id = _proposalID;
                    sOrder.CustomerId.Id = _customerID;
                    sOrder.AccountId.Id = _customerID;
                    _context.AddToSalesOrderSet(sOrder);
                    _context.UpdateObject(sOrder);
                    _context.BeginSaveChanges(OnAddOrderComplete, sOrder);

    I added the AccountId.id thinking that may be what it was looking for but it didn't make any difference. 

    Anyone seen this?

    Thanks,
    LLB

     

    Thanks,

    Larry


    WeDoMapping

    Thursday, June 28, 2012 6:29 PM

Answers

  • The below works, Silverlight doesn't have Account.EnitityLogicalName.

    SalesOrder sOrder = new SalesOrder(); EntityReference CustomerID = new EntityReference(); CustomerID.LogicalName = "account" ; CustomerID.Id = _customerID; sOrder.CustomerId = CustomerID; sOrder.QuoteId.Id = _proposalID; _context.AddToSalesOrderSet(sOrder); _context.UpdateObject(sOrder); _context.BeginSaveChanges(OnAddOrderComplete, sOrder);



    WeDoMapping

    Thursday, June 28, 2012 7:07 PM

All replies

  • Probably try:

    sOrder.CustomerId = new EntityReference(Account.EntityLogicalName, _customerID);
    sOrder.AccountId= new EntityReference(Account.EntityLogicalName, _customerID);

    Hope this helps.

    Thursday, June 28, 2012 6:55 PM
  • The below works, Silverlight doesn't have Account.EnitityLogicalName.

    SalesOrder sOrder = new SalesOrder(); EntityReference CustomerID = new EntityReference(); CustomerID.LogicalName = "account" ; CustomerID.Id = _customerID; sOrder.CustomerId = CustomerID; sOrder.QuoteId.Id = _proposalID; _context.AddToSalesOrderSet(sOrder); _context.UpdateObject(sOrder); _context.BeginSaveChanges(OnAddOrderComplete, sOrder);



    WeDoMapping

    Thursday, June 28, 2012 7:07 PM
  • The below works, Silverlight doesn't have Account.EnitityLogicalName.

    SalesOrder sOrder = new SalesOrder(); EntityReference CustomerID = new EntityReference(); CustomerID.LogicalName = "account" ; CustomerID.Id = _customerID; sOrder.CustomerId = CustomerID; sOrder.QuoteId.Id = _proposalID; _context.AddToSalesOrderSet(sOrder); _context.UpdateObject(sOrder); _context.BeginSaveChanges(OnAddOrderComplete, sOrder);



    WeDoMapping

    Glad it worked out. So, missing the logicalname was indeed the problem then.
    Thursday, June 28, 2012 7:11 PM