Page 1 of 1

Reserved Order Number Report in API

Posted: Mon Feb 22, 2021 2:52 pm
by KWoods
Is there a way to generate the Reserved Order Number Report(DOC_SPUNR_ReservedOrdersByProjectID) in the API? I am able to generate a report by using a GUID from a previously generated report, but would like to be able to generate the GUID in the API and then get the report using that new GUID. Is this possible or can the report only be generated in the API by using a GUID from a previous report?

Re: Reserved Order Number Report in API

Posted: Mon Feb 22, 2021 3:14 pm
by Lisa Ennis
The DOC_SPUNR_ReservedOrdersByProjectID report is used in the Reserve Order Numbers wizard (accessed from the "Create New Items" button). The wizard generates a new guid for the project id and the report prints from the wizard. I do not work with the API to be able to provide any assistance with that other than to say I believe the API would need to generate the new project id the same way the wizard does.

Re: Reserved Order Number Report in API

Posted: Mon Feb 22, 2021 5:49 pm
by KWoods
I did get this figured out. I had to Create the reserved orders using an OrderReservation and OrderReservationBatch. Added the OrderReservationBatch to the OrderReservation and then created with the IOrderStore. Pertinent bits below:

IOrderStore os = userObject.sps.GetService<IOrderStore>();
OrderReservation res = new OrderReservation();
OrderReservationBatch resbatch = new OrderReservationBatch();

resbatch.Count = 10;//number of orders to reserve
resbatch.Profile = pm.ActiveProfile.ID;

DateTime dt = DateTime.Now;
res.Project = "LoadTestTest" + dt;
res.Suffix = "AU";
res.TrustAccountID = tiInfo.ID;
res.Batches.Add(resbatch);

IReserveOrdersResult order = os.ReserveOrders(res);

string ProjectID = order.ProjectID.ToString();