Do you have a sample code for how to save a new order usins SPS API that has a joint buyer/seller? The following piece of code doesn't save buyer/seller information and I don't know what is wrong in the code.
IBuyer oBuyer = order.Buyer.CreateNew();
oBuyer.Type = "Joint";
gBuyerID = oBuyer.ID;
bNextSpouse = true;
oBuyer.IndivName1First = xmlContact.Attributes["FIRSTNAME"].Value;
oBuyer.IndivName1Last = xmlContact.Attributes["LASTNAME"].Value;
oBuyer.IndivName1Middle = xmlContact.Attributes["MIDDLENAME"].Value;
oBuyer.CurrentAddress1 = xmlContact.Attributes["ADDRESS_1"].Value;
oBuyer.CurrentAddress2 = xmlContact.Attributes["ADDRESS_2"].Value;
oBuyer.City = xmlContact.Attributes["CITY"].Value;
oBuyer.State = xmlContact.Attributes["STATE"].Value;
oBuyer.Zip = xmlContact.Attributes["ZIPCODE"].Value;
oBuyer.IndivName1CurrentWork = xmlContact.Attributes["PHONE"].Value;
oBuyer.IndivName1CurrentFax = xmlContact.Attributes["FAX"].Value;
oBuyer.IndivName1CurrentEmail = xmlContact.Attributes["EMAIL"].Value
if (bNextSpouse == true)
{
try
{
bNextSpouse = false;
IBuyer oBuyer = order.Buyer[order.Buyer.Count - 1];
oBuyer.IndivName2First = xmlContact.Attributes["FIRSTNAME"].Value;
oBuyer.IndivName2Last = xmlContact.Attributes["LASTNAME"].Value;
oBuyer.IndivName2Middle = xmlContact.Attributes["MIDDLENAME"].Value;
oBuyer.IndivName2CurrentWork = xmlContact.Attributes["PHONE"].Value;
oBuyer.IndivName2CurrentFax = xmlContact.Attributes["FAX"].Value;
oBuyer.IndivName2CurrentEmail = xmlContact.Attributes["EMAIL"].Value;
}
Thanks
Sanjay
SPS API - Creating New Orders with Joint Buyers/Seller
Moderator: Phil Barton
-
- Posts: 94
- Joined: Mon Dec 28, 2009 3:43 pm
Re: SPS API - Creating New Orders with Joint Buyers/Seller
Sanjay,
Using shortcut properties such as "IndivName1First" seems to expose a flaw in our current API. As a workaround, try using the "BuyerSellerPerson" collection off of the IBuyer object:
Thanks for reporting this to us. I will log a bug against it for our next release.
Using shortcut properties such as "IndivName1First" seems to expose a flaw in our current API. As a workaround, try using the "BuyerSellerPerson" collection off of the IBuyer object:
Code: Select all
IBuyer buyer = order.Buyer.CreateNew();
buyer.BuyerSellerPerson[0].FirstName = ...
buyer.BuyerSellerPerson[0].LastName = ...
...
buyer.BuyerSellerPerson[1].FirstName = ...
buyer.BuyerSellerPerson[1].LastName = ...
-
- Posts: 94
- Joined: Mon Dec 28, 2009 3:43 pm
Re: SPS API - Creating New Orders with Joint Buyers/Seller
Thanks Hadi,
Actually setting the value in of BuyerSellerPerson[0] property works fine to save the values in the first name and the last name, but it doesn't autopopulate the same value to the "Name" field. So it doesn't display the Joint first name and last name on the Exprss Order Entry Screen. What do I need to do to persist the values in the "Name" field?
Regards,
Sanjay
Actually setting the value in of BuyerSellerPerson[0] property works fine to save the values in the first name and the last name, but it doesn't autopopulate the same value to the "Name" field. So it doesn't display the Joint first name and last name on the Exprss Order Entry Screen. What do I need to do to persist the values in the "Name" field?
Regards,
Sanjay
-
- Posts: 54
- Joined: Wed Sep 24, 2008 2:37 pm
- Location: Raleigh, NC
- Contact:
Re: SPS API - Creating New Orders with Joint Buyers/Seller
Sanjay,
The "Name" property on the IBuyer is automatically populated through business rules unless there exists a user-entered value within that property. The following code populates the people of a joint buyer. It properly updates the "Name" property of the IBuyer and appears properly on the Express Order Entry screen in Select:
NOTE: The Assert.AreEqual(...) method is part of the NUnit framework.
The "Name" property on the IBuyer is automatically populated through business rules unless there exists a user-entered value within that property. The following code populates the people of a joint buyer. It properly updates the "Name" property of the IBuyer and appears properly on the Express Order Entry screen in Select:
Code: Select all
IBuyer buyer = order.Buyer.CreateNew();
buyer.Type = @"Joint";
buyer.BuyerSellerPerson[0].FirstName = @"First1";
buyer.BuyerSellerPerson[0].LastName = @"Last1";
buyer.BuyerSellerPerson[1].FirstName = @"First2";
buyer.BuyerSellerPerson[1].LastName = @"Last2";
Assert.AreEqual(buyer.Name, @"First1 Last1 and First2 Last2", @"The buyer name is not correct");
Phil Barton
Software Architect
SoftPro
Software Architect
SoftPro