Code executing on the IIS - need help in marshaling the datatypes

Hello,

   I am making some customizations to the Warehouse mobile portal in Dynamics AX 2012 R3 CU12.  I have put together code and it works as expected when I debug and run it from the AOT by running the WHSWorkExecute form. But when I run it from the web browser it is not functioning as it does when I run it from the AOT by running the form.

As part of the customization, I have this method in x++. When this method is executed on the server it seems like the _buttonClicked parameter (being an x++ str) it is not properly marshaling to the .NET string please see the code below. I am not sure if I am missing something but the switch case is not picking up the string value that is coming in for the _buttonClicked parameter.

private Qty masGetTotalQty(Qty _totalQty, Qty _qtyCounted, str _buttonClicked = "")
{
    System.String       strLocal;
    str                 strButtonClicked;
    System.String       strReCount, strAdd;
    strLocal         = _buttonClicked;
    strButtonClicked = strLocal.ToString();
    strReCount = "ReCount";
    strAdd    = "Add";
    
    switch (strLocal)
    {
        //case #RFReCount:
        case strReCount:
            return any2real(0);

        //case #RFAdd:
        case strAdd:
            return _qtyCounted + _totalQty;
                            
        default:
            if(masWorkLineCycleCountItemExists)
            {
                return _qtyCounted;
            }
            
        return _totalQty;
    }
}

I have the below macros defined at the class level

//I have these macros defined at the class level
#define.RFAdd('Add')
#define.RFBackToItem('BackCount')
#define.QtyCounted('QtyCuonted')
#define.RFReCount('Recount')

It always executing the default block of the switch case and not being able to identify the button that was clicked on the browser. In the case of a AX web service I can debug the code from Visual studio by attaching the AX32Serv.exe but I am not sure how can I debug from the browser in the case of the mobile client.

Am I missing something here?

Thanks,

Dave

Related
Recommended