UpdateSupplier - accountsIQ/API-Wiki GitHub Wiki

The UpdateSupplier function creates or updates a single Supplier back to an entity.

Please take note of the create parameter when using this has it has an effect on results.

When updating, make sure to get new rowversion Supplier on field as this changes after an update. To get an updated version on this field, please call GetSupplier and use the new rowversion in the update request.

Declaration

C#

public WSResult2OfBoolean UpdateSupplier(string token, Supplier Supplier, bool create)

Visual Basic

Public Function UpdateSupplier(ByVal token As String, ByVal Supplier As Supplier, ByVal create As Boolean) As WSResult2OfBoolean

Parameter List

Parameter Type Description
token String The session token retrieved during authentication.
Supplier Supplier The Supplier object to create/update.
create Boolean Flag indicating whether the system should create the Supplier code if it does not already exist. True: the Supplier is updated or created if it does not exist; False: the Supplier code can only by updated, not created.

Example

C#

Integration ws = new Integration();

String auth = ws.Login(entityID, partnerKey, userKey);
if (auth != null)
{
  WSResult2OfSupplier wsSupplier = ws.GetSupplier(auth, "TESTINTEGR");
  Assert.IsNotNull(wsSupplier);
  Supplier Supplier = wsSupplier.Result;
  Assert.IsNotNull(Supplier);

  Supplier.Name = "ABC Account 01 - update";
  Supplier.Address1 = "this is my address 1 - update";
  Supplier.Address2 = "this is my address 2 - update";
  Supplier.City = "this is my city - update";
  Supplier.County_State = "this is my county - update";
  Supplier.Country = "this is my country - update";
  Supplier.PostCode = "this is my postcode - update";
  Supplier.Contact = "Contact - update";
  Supplier.Email = "[email protected]";
  Supplier.Fax = "0123459";
  Supplier.Phone = "0123457";

  WSResult2OfBoolean result = ws.UpdateSupplier(auth, Supplier, false);
  Assert.IsNotNull(result);
  Assert.AreEqual(true, result.Result);

  wsSupplier = ws.GetSupplier(auth, "TESTINTEGR");
  Supplier = wsSupplier.Result;
  Assert.IsNotNull(Supplier);
  Assert.AreEqual("TESTINTEGR", Supplier.Code);
  Assert.AreEqual("ABC Account 01 - update", Supplier.Name);
  Assert.AreEqual("this is my address 1 - update", Supplier.Address1);
  Assert.AreEqual("this is my address 2 - update", Supplier.Address2);
  Assert.AreEqual("this is my city - update", Supplier.City);
  Assert.AreEqual("this is my county - update", Supplier.County_State);
  Assert.AreEqual("this is my country - update", Supplier.Country);
  Assert.AreEqual("this is my postcode - update", Supplier.PostCode);
  Assert.AreEqual("Contact - update", Supplier.Contact);
  Assert.AreEqual("[email protected]", Supplier.Email);
  Assert.AreEqual("0123459", Supplier.Fax);
  Assert.AreEqual("0123457", Supplier.Phone);

  Supplier.Name = "ABC Account 01";
  Supplier.Address1 = "this is my address 1";
  Supplier.Address2 = "this is my address 2";
  Supplier.City = "this is my city";
  Supplier.County_State = "this is my county";
  Supplier.Country = "this is my country";
  Supplier.Country = "this is my country";
  Supplier.PostCode = "this is my postcode";
  Supplier.Contact = "Contact";
  Supplier.Email = "[email protected]";
  Supplier.Fax = "0123489";
  Supplier.Phone = "0123456";

  result = ws.UpdateSupplier(auth, Supplier, false);
  Assert.IsNotNull(result);
  Assert.AreEqual(true, result.Result);

  wsSupplier = ws.GetSupplier(auth, "TESTINTEGR");
  Supplier = wsSupplier.Result;
  Assert.IsNotNull(Supplier);
  Assert.AreEqual("TESTINTEGR", Supplier.Code);
  Assert.AreEqual("ABC Account 01", Supplier.Name);
  Assert.AreEqual("this is my address 1", Supplier.Address1);
  Assert.AreEqual("this is my address 2", Supplier.Address2);
  Assert.AreEqual("this is my city", Supplier.City);
  Assert.AreEqual("this is my county", Supplier.County_State);
  Assert.AreEqual("this is my country", Supplier.Country);
  Assert.AreEqual("this is my postcode", Supplier.PostCode);
  Assert.AreEqual("Contact", Supplier.Contact);
  Assert.AreEqual("[email protected]", Supplier.Email);
  Assert.AreEqual("0123489", Supplier.Fax);
  Assert.AreEqual("0123456", Supplier.Phone);
}

Visual Basic

Dim ws As New Integration

Dim auth As String = ws.Login(entityID, partnerKey, userKey)
If (Not Me.auth Is Nothing) Then
  Dim wsSupplier As WSResult2OfSupplier = Me.ws.GetSupplier(Me.auth, "TESTINTEGR")
  Assert.IsNotNull(wsSupplier)
  Dim Supplier As Supplier = wsSupplier.Result
  Assert.IsNotNull(Supplier)
  Supplier.Name = "ABC Account 01 - update"
  Supplier.Address1 = "this is my address 1 - update"
  Supplier.Address2 = "this is my address 2 - update"
  Supplier.City = "this is my city - update"
  Supplier.County_State = "this is my county - update"
  Supplier.Country = "this is my country - update"
  Supplier.PostCode = "this is my postcode - update"
  Supplier.Contact = "Contact - update"
  Supplier.Email = "[email protected]"
  Supplier.Fax = "0123459"
  Supplier.Phone = "0123457"
  Dim result As WSResult2OfBoolean = Me.ws.UpdateSupplier(Me.auth, Supplier, False)
  Assert.IsNotNull(result)
  Assert.AreEqual(Of Boolean)(True, result.Result)
  Supplier = Me.ws.GetSupplier(Me.auth, "TESTINTEGR").Result
  Assert.IsNotNull(Supplier)
  Assert.AreEqual(Of String)("TESTINTEGR", Supplier.Code)
  Assert.AreEqual(Of String)("ABC Account 01 - update", Supplier.Name)
  Assert.AreEqual(Of String)("this is my address 1 - update", Supplier.Address1)
  Assert.AreEqual(Of String)("this is my address 2 - update", Supplier.Address2)
  Assert.AreEqual(Of String)("this is my city - update", Supplier.City)
  Assert.AreEqual(Of String)("this is my county - update", Supplier.County_State)
  Assert.AreEqual(Of String)("this is my country - update", Supplier.Country)
  Assert.AreEqual(Of String)("this is my postcode - update", Supplier.PostCode)
  Assert.AreEqual(Of String)("Contact - update", Supplier.Contact)
  Assert.AreEqual(Of String)("[email protected]", Supplier.Email)
  Assert.AreEqual(Of String)("0123459", Supplier.Fax)
  Assert.AreEqual(Of String)("0123457", Supplier.Phone)
  Supplier.Name = "ABC Account 01"
  Supplier.Address1 = "this is my address 1"
  Supplier.Address2 = "this is my address 2"
  Supplier.City = "this is my city"
  Supplier.County_State = "this is my county"
  Supplier.Country = "this is my country"
  Supplier.Country = "this is my country"
  Supplier.PostCode = "this is my postcode"
  Supplier.Contact = "Contact"
  Supplier.Email = "[email protected]"
  Supplier.Fax = "0123489"
  Supplier.Phone = "0123456"
  result = Me.ws.UpdateSupplier(Me.auth, Supplier, False)
  Assert.IsNotNull(result)
  Assert.AreEqual(Of Boolean)(True, result.Result)
  Supplier = Me.ws.GetSupplier(Me.auth, "TESTINTEGR").Result
  Assert.IsNotNull(Supplier)
  Assert.AreEqual(Of String)("TESTINTEGR", Supplier.Code)
  Assert.AreEqual(Of String)("ABC Account 01", Supplier.Name)
  Assert.AreEqual(Of String)("this is my address 1", Supplier.Address1)
  Assert.AreEqual(Of String)("this is my address 2", Supplier.Address2)
  Assert.AreEqual(Of String)("this is my city", Supplier.City)
  Assert.AreEqual(Of String)("this is my county", Supplier.County_State)
  Assert.AreEqual(Of String)("this is my country", Supplier.Country)
  Assert.AreEqual(Of String)("this is my postcode", Supplier.PostCode)
  Assert.AreEqual(Of String)("Contact", Supplier.Contact)
  Assert.AreEqual(Of String)("[email protected]", Supplier.Email)
  Assert.AreEqual(Of String)("0123489", Supplier.Fax)
  Assert.AreEqual(Of String)("0123456", Supplier.Phone)
End If

See Also

⚠️ **GitHub.com Fallback** ⚠️