Create pre-return shipment and add products to list

Hello!! , first Thanks to all for the usefull help that i’ be found here.!!
i have a new challenge for me and has been very dificult , (sorry 4 the english)

1st : i need to create a “pre-Shipment” fron one location to another via API , like this on the system

2nd : them with the created “shipmnet” asociate to this , some products to be returnned just like the image.

i cant figure it out , ik tri to use ilspy to decomplie de dll and know more about the methods but is take to many time to resolve it…

plase , need your helpful experience!!


        Shipment preReturn = Shipment.NewShipment(ShipmentStatusType.PreReturn);
        preReturn.ToLocationType = SourceType.BranchOffice;
        preReturn.ToStockingLocationID = <to-loc-id>;
		preReturn.FromLocationType = SourceType.JobSite;
        preReturn.FromStockingLocationID = <from-loc-id>;
		preReturn.DriverID = <driver-id> //Driver id can be retrieved from name as Driver.GetDriver(<Driver-Name>).DriverID;
1 Like

Thanks, i need the product asociations too.

Shipment preReturn = Shipment.GetShipmentOfStatus([SHIPMENT-ID], true, false, true, ShipmentStatusType.NewDirectShip);
preReturn.ShipmentStatus = ShipmentStatusType.NewDirectShip;

preReturn.ShipmentProducts["[PROD-NUM]", Guid.Empty].SentQuantity = 1;
preReturn.ShipmentProducts["[PROD-NUM]", Guid.Empty].SentQuantity = 1;

preReturn.ReturnRentStopDate = new SmartDate(DateTime.Today);