Delivery Lock During Editing from Plugin

Tags: v9

The ability to lock delivery during editing from the plugin has been added to prevent conflicts when editing simultaneously through Front and the web Call Center.

Features

Usage

The TryStartDeliveryEdititng method can only be used within ExecuteContinuousOperation. The lock is automatically released upon exiting ExecuteContinuousOperation.

PluginContext.Operations.ExecuteContinuousOperation(os =>
{
    var delivery = os.GetDeliveryOrders().Last();
    if (os.TryStartDeliveryEdititng(delivery.Id))
    {
        // Delivery is locked, editing can proceed
        var editSession = os.CreateEditSession();
        // Make changes
        os.SubmitChanges(editSession);
    }
    else
    {
        // Handle the situation when the delivery is already locked
    }
});

See also