Hello,
Is it possible to get a TrackingNumber from commerce before I create an order I want to avoid to create my own Tracking Number system. The API doesn't seem to expose methods to grab the next Tracking Number and I couldn't find a stored procedure. I traced the calls to the DB and it seems to be calling the IdentityCounter table from internally.
Thanks, Patrick

Getting the Tracking Number From Commerce in the basket
Adnanans78
Vinayak,
Fantastic, thanks! I'll add that to our build and share it with the team.
Cheers,
Colin
El Bruno
Hey Patrick,
You can assign the tracking number yourself before saving it as an order. We ended up doing this because CS2007 allocates 5,000 order numbers for each application instance. If the application pool is reset you jump up to the next block of 5,000. We noticed this first when unit testing.
Here's the stored procedure that we use to do this:
CREATE PROCEDURE [dbo].[RetrieveNextTrackingNumber]
AS
BEGIN
BEGIN TRANSACTION
UPDATE IdentityCounter
SET CurrentId = CurrentId + 1
WHERE CounterName = 'PuchaseOrder.TrackingNumber'
SELECT CurrentId
FROM IdentityCounter
WHERE CounterName = 'PuchaseOrder.TrackingNumber'
COMMIT TRANSACTION
END
Cheers,
Colin
C McQuade
I posted a bit of more depth on the issue on my blog... http://blogs.rockstarguys.com/blogs/colin/archive/2006/11/10/18.aspx
Qaayam
Marshall Brooke
Hi Colin,
You should be able to do the above in one upate statement
CREATE PROCEDURE [dbo].[RetrieveNextTrackingNumber]
AS
BEGIN
Declare @CurrentId int
UPDATE IdentityCounter
SET @CurrentId = CurrentId = CurrentId + 1
WHERE CounterName = 'PuchaseOrder.TrackingNumber'
Select @CurrentId
END