Ask a questionAsk a question
 

AnswerModify a purchase order

  • Wednesday, October 28, 2009 3:43 PMKevinBurton Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    This question is regarding SavePurchaseOrder, UpdatePurchaseOrder, and UpdatePurchaseOrderProperties methods in the PurchaseOrderManager class.

    1) Is there a functional difference between SavePurchaseOrder and UpdatePurchaseOrder?
    2) If I have a purchase order as XML (GetPurchaseOrderAsXml) and I want to change one of the attributes of one of the nodes can I use UpdatePurchaseOrderProperties or am I forced to SavePurchaseOrder even if all I changed was an attribute? If I can use UpdatePurchaseOrderProperties what is the format of the XmlElement for a "property" that is an attribute?

    I see that if I want to search the database for a particular purchase order it seems that I am better off programming using the DataSet model. What are the scenarios which I am better off using XML?

    Thank you.

    Kevin

Answers

All Replies

  • Wednesday, October 28, 2009 9:01 PMCyril Rebreyend Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Proposed Answer
    Hi Kevin,

    looks like i am your best friend today ! :)


    to change some attributes to a purchase order, you should use UpdatePurchaseOrder this way :
    http://msdn.microsoft.com/en-us/library/bb219142.aspx
    It is incredibely faster than the save method applied to dataset.

    hth,
    Cyrebre
  • Wednesday, October 28, 2009 9:58 PMKevinBurton Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    But the change is still applied to the DataSet. You are saying that UpdatePurchaseOrder is faster than . . . .

    Thank you.

    Kevin
  • Thursday, October 29, 2009 8:08 PMCyril Rebreyend Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I don't understand... What do you mean by 'the change is still applied to dataset' ?
  • Thursday, October 29, 2009 10:39 PMKevinBurton Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    This articl only deals with DataSets. It doesn't use XML at all.

    Kevin
  • Friday, October 30, 2009 9:33 AMCyril Rebreyend Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Sorry, I posted the wrong link. This one should help you : http://msdn.microsoft.com/en-us/library/microsoft.commerceserver.orders.purchaseordermanager.updatepurchaseorderproperties.aspx

    And the method you should use is UpdatePurchaseOrderProperties , not updatepurchaseorder.

    hth,
    Cyrebre
  • Friday, November 06, 2009 7:08 PMKevinBurton Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    For example if I want to modify more than one attribute/property on the PurchaseOrder element would I just add another PurchaseOrder element or do I need to call UpdatePurchaseOrderProperties once for each property that I want to modify?

    Thanks again.

    Kevin

  • Friday, November 06, 2009 9:32 PMCyril Rebreyend Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    No, the aim of this function is to bulk modify your PO; so you can update a lot of PO With just 1 call.

    Cyrebre
  • Wednesday, November 11, 2009 5:22 AMKevinBurton Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Another question if you don't mind. We have "extended" the LineItem and OrderForm. We call our extended version BsiLineItem and BsiOrderForm. If we substitute BsiLineItem for LineItem in the Xml that is passed to UpdatePurchaseOrderProperties and use our extended properties, this will work right?

    Kevin
  • Wednesday, November 11, 2009 8:54 AMCyril Rebreyend Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Normally you should extend your webservice too (copy the orderobjectsmapping.xml and orderpipelinemappings.xml to the webservice folder) and then the WS will return you BsiLineItem instead of LineItem.

    hth
    Cyrebre
  • Wednesday, November 11, 2009 3:29 PMKevinBurton Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    We have done this. Is what I see in GetPurchaseOrderAsXml is a structure like:

    <LineItems>
       <BsiLineItem . . . . ./>
       <BsiLineItem . . . . ./>

    If I want to changed the property/attribute of a *BsiLineItem* can I feed Xml like:

    <PurchaseOrderUpdates>
        <BsiLineItem LineItemId=.... PropertyName=... PropertyValue=.... />
        <BsiLineItem LineItemId=.... PropertyName=... PropertyValue=.... />
    .  .  .

    ?

    Thank you.

    Kevin
  • Thursday, November 12, 2009 7:44 AMCyril Rebreyend Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I think it's the way it works, but i didn't test it (we don't update lineitems on our site).
    But if you try i'm interested in the result.

    ++
    Cyrebre