Tuesday, August 11, 2015

Navigate to a page in Ax 2012 Modern POS by using JS and Blank Operation

Follow the below steps to navigate to a page in AX 2012 Modern POS by using JS and Blank operation.
1. Create a Button grid and add a Button to it.
2. Select the button properties and set the operation as Blank operation and 
        Operation number as XXX. If required parameters also can be given. 
        Run the Distribution Schedule "Registers"(1090).
3. Open POS Client >windows> C1>POS solution in visual studio.
4. Open the POS.Js file and find for the Blank operation Case and add 
        the below code to navigate to Categories view.
                        
                        var parameters= actionProperty.split(";");
                         
                        if (parameters[0] == "XXX")
                            Commerce.ViewModelAdapter.navigate("CategoriesView");
                        return true;

5. Now create a package and install / execute the solution from Visual studio.
6. Click on the button created in 1st step it will redirect to Categories View page

Wednesday, August 5, 2015

AX 2012 Workflow Batch Job "Failed to find workflow" error

AX 2012 workflow batch job fails with the error "Failed to find workflow" message.

To resolve the error find the Record which is in queue and causing the issue and update MessageLifeCycleState to 2.

The below code will give you the record which is causing the error.
SYSWORKFLOWMESSAGETABLE SYSWORKFLOWMESSAGETABLE;
SYSWORKFLOWTABLE SYSWORKFLOWTABLE;

while Select RECID from SYSWORKFLOWMESSAGETABLE 
    Where SYSWORKFLOWMESSAGETABLE.MESSAGELIFECYCLESTATE == 1  && SYSWORKFLOWMESSAGETABLE.ROOTCORRELATIONID
notexists join SYSWORKFLOWTABLE 
    where SYSWORKFLOWMESSAGETABLE.RootCorrelationId == SYSWORKFLOWTABLE.RootCorrelationId
    {
        info(strFmt("%1",SYSWORKFLOWMESSAGETABLE.RecId));

    }