Caveman's Blog

My commitment to learning.

Commerce Server 2007 – Extending the PurchaseOrder

leave a comment »

The purchase order table in CS 2007 comes with a limited default storage columns. What if you want to add new columns to this table that would be used to… hmmm… lets say query the PO table?

the answer is simple: Extend the PurchaseOrder !!!

Here is how I have dunit.

1. Extend the PurchaseOrder class (lets call it ExtendedPurchaseOrder and define the property that you would like to store in the Commerce Server PurchaseOrders table in the transactions database.

2. Add the new columns to the following section of OrderObjectMappings.xml


3. Change the name of the class from PurchaseOrder to ExtendedPurchaseOrder in the following section

4. Add the new class property to table column mapping in the following section of the same xml:

5. Add the following section to the web.config file in the CommerceServer/Types section

6. Create a new folder; say c:\temp and copy web.config, OrderObjectMappings.xml, YourClassLibrary.dll and the OrderMappings.exe to this folder. You should be able to find the OrderMappings.exe in the C:\Program Files\Microsoft Commerce Server 2007\Tools folder.

7. Open a Command window and run the following script to generate the SQL for Commerce server Transactions database.

OrderMappings -w web.config

8. You should a file OrdersStorage.sql being generate if the above command ran successfully.

9. Execute the SQL script in the OrdersStorage.sql file on the Commerce server transactions database after you have made the necessary schema change to the PurchaseOrders table.

10. Now you are ready to programatically insert custom data into the PurchaseOrders table.

11. I have inserted the Order Confirmation Number into the PurchaseOrders using the following code

ExtendedPurchaseOrder PO = (ExtendedPurchaseOrder ) this.Basket.SaveToReceipt();
PO.ConfirmationNumber = 100001;
PO.ListenerStatus = 1;


1. MSDN Online



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: