Check if order state change is triggered from backoffice (isUserInitiable)

Hi!

Is it possible to know if a request to change the state of an order was triggered from backoffice by a user? I’ve set isUserInitiable to true(Code below). But I want to catch that event so i can override the transition conditions in that case.

        private void TransitionFromReadyForERP(OrderStateMachine stateMachine, State<OrderCarrier> readyForErp, State<OrderCarrier> completed)
    {
        stateMachine.AddStateTransition(readyForErp, completed, 
            (orderCarrier, readyForErp, completed, token) =>
            {
                if (orderCarrier.Type == OrderType.SalesReturnOrder)
                {
                    return false;
                }
                return IsSentToErp(orderCarrier);

            }, true);
    }

Litium version: 7.3.2

When or if this is made by someone from BO then

_routeRequestLookupInfoAccessor.RouteRequestLookupInfo

is populated otherwise it will be null.

The routeRequestLookupInfoAccessor.RouteRequestLookupInfo is null for me when triggering state change from BO.

_routeRequestLoopupInfoAccessor

For some reason I was only looking to do this with Litium services but forgot about
HttpContext.Current.Request which will be null when used by tasks for example. One can also make sure that /Litium/ exist in the requested url.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.