function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Marek CechMarek Cech 

Continuation continuationMethod not executed sometimes

Hi,

I've got a problem with Continuation. In one of several hundread executions the method for processing response is not executed. There is logging in the method so I'm pretty sure this happens. Wierd thing is that onComplete Javascript function of ActionFunction is executed.

public Continuation moveToStage5() {
        Continuation cont = new Continuation(timeout);
        cont.continuationMethod = 'processMoveToStage5Response';

        AsyncSapOrderWS.Asyncy_sf_saveorder service = new AsyncSapOrderWS.Asyncy_sf_saveorder();
        activationResponse = service.beginYSfSaveorder(cont, acc.SAP_ID__c, latestOrderDto.customerNote, sapUserId, 
            orderRecord.OrderNumber, SAP_ORDER_TYPE, preferedDeliveryDate, priceDate, latestOrderProducts, 
            selectedSellingOrganisation, orderSalesType, '');
        
        return cont;
}

public Object processMoveToStage5Response() {
        SapOrderWS.YSfSaveorderResponse_element response;
        try {
            response = activationResponse.getValue();

            GlobalUtility.logMessage(GlobalUtility.DEBUG, AddOrderController.class.getName(), 'processMoveToStage5Response', null, null, 
                response.toString(), null, null, 0, true);

        } catch (Exception e) {
            response = new SapOrderWS.YSfSaveorderResponse_element();
            response.Error = Label.errMsg_ErrorCreatingOrder + ' ' + Label.msg_PleaseContactAdmin + ' (' + e + ')';
            GlobalUtility.logMessage(GlobalUtility.ERROR, AddOrderController.class.getName(), 'processMoveToStage5Response', null, null, 
                Label.errMsg_ErrorCreatingOrder, null, e, 0, false);
                
            orderResponseJson = JSON.serialize(response);
            return null;
        }
        return null;
    }

Has anyone experienced such thing?
Marek CechMarek Cech
public Continuation moveToStage5() {
        Continuation cont = new Continuation(timeout);
        cont.continuationMethod = 'processMoveToStage5Response';

        AsyncSapOrderWS.Asyncy_sf_saveorder service = new AsyncSapOrderWS.Asyncy_sf_saveorder();
        activationResponse = service.beginYSfSaveorder(cont, acc.SAP_ID__c, latestOrderDto.customerNote, sapUserId, 
            orderRecord.OrderNumber, SAP_ORDER_TYPE, preferedDeliveryDate, priceDate, latestOrderProducts, 
            selectedSellingOrganisation, orderSalesType, '');
        
        return cont;
}

public Object processMoveToStage5Response() {
        SapOrderWS.YSfSaveorderResponse_element response;
        try {
            response = activationResponse.getValue();

            GlobalUtility.logMessage(GlobalUtility.DEBUG, AddOrderController.class.getName(), 'processMoveToStage5Response', null, null, 
                response.toString(), null, null, 0, true);

        } catch (Exception e) {
            response = new SapOrderWS.YSfSaveorderResponse_element();
            response.Error = Label.errMsg_ErrorCreatingOrder + ' ' + Label.msg_PleaseContactAdmin + ' (' + e + ')';
            GlobalUtility.logMessage(GlobalUtility.ERROR, AddOrderController.class.getName(), 'processMoveToStage5Response', null, null, 
                Label.errMsg_ErrorCreatingOrder, null, e, 0, false);
                
            orderResponseJson = JSON.serialize(response);
            return null;
        }
        return null;
    }