Update Parties

Version: 8.2

Developer tasks for using service method UpdateParties.

UpdateParties is used to update party information in an existing cart.

At your Visual Studio solution setup:

  1. Reference the Sitecore.Commerce.Connect.CommerceServer and Sitecore.Commerce.dll.

  2. Pick the class in your solution where want to use this service method.

  3. Paste in the code below to use the service method.

    RequestResponse
    var  customerService =  new  CustomerServiceProvider();
    
    // create a customer
    var  customer = customerService.CreateCustomer( new  CreateCustomerRequest(
         new  CommerceCustomer
        {        
        Name =  "Jeff" ,
        Shops =  new [] {  "autohaus"  },
        ExternalId =  "1234567890"
        })).CommerceCustomer;
    
    var  parties =  new List <Party>
    {     
    new  Party {ExternalId =  "1234567890" , Address1 =  "123 My Street" , City =  "My City" , Country =  "My Country" , PartyId =  "1" }
    };
    // add the party
    var  addRequest =  new  AddPartiesRequest(customer, parties);
    var  addResult = customerService.AddParties(addRequest); 
    
    parties.Add( new  Party { ExternalId =  "9876543210" , Address1 =  "123 My Road" , City =  "My Town" , Country =  "Your Country" , PartyId =  "2"  });
    // update the parties
    var  updateRequest =  new  UpdatePartiesRequest(customer, parties);
    var  getResult = customerService.UpdateParties(updateRequest);

Do you have some feedback for us?

If you have suggestions for improving this article,