We have a scheduled job running every 10 minutes that exports shipments for Purchase orders based on different criteria. One of the main criteria is a flag we set on the shipment via a custom property. Once the shipment is processed and exported, we set the flag. What we are finding is that occasionally shipments are included more than once. The job normally completes within a few seconds.
I'm using the OrderContext to retrieve PurchaseOrders and subsequent Shipments. I'm updating the flag on the Shipment via AcceptChanges. Just wondering if there is caching in play here and if there is a better way via the API to retrieve and update. Would updating the shipment in this way evict the PurchaseOrder from cache so when retrieving the PurchaseOrder the next time the updated shipment would be included?
var poList = OrderContext.Current.Search<PurchaseOrder>(searchParams, new OrderSearchOptions
{
CacheResults = false,
StartingRecord = 0,
Namespace = "Mediachase.Commerce.Orders"
});
Shipment.SetMetaField(Global.Metadata.Shipment.Export, true);
Shipment.AcceptChanges();
Hi Guys,
We have a scheduled job running every 10 minutes that exports shipments for Purchase orders based on different criteria. One of the main criteria is a flag we set on the shipment via a custom property. Once the shipment is processed and exported, we set the flag. What we are finding is that occasionally shipments are included more than once. The job normally completes within a few seconds.
I'm using the OrderContext to retrieve PurchaseOrders and subsequent Shipments. I'm updating the flag on the Shipment via AcceptChanges. Just wondering if there is caching in play here and if there is a better way via the API to retrieve and update. Would updating the shipment in this way evict the PurchaseOrder from cache so when retrieving the PurchaseOrder the next time the updated shipment would be included?
Cheers
Mark