//This example demonstrates the conditional navigation functionality for an online request.
//In this example we skip the list view screen and go directly to the details screen if there is only one item in the list
function customConditionalNavigation(currentScreenKey, actionName, defaultNextScreen, conditionName, workflowMessage) {
    if ((currentScreenKey === 'Process') && (actionName === 'Previous Expenses')) {
        if (conditionName === 'ONE_ROW') {
            var values = workflowMessage.getValues();
            var m = workflowMessage.serializeToString();
            var expenseTracking = values.getData("ExpenseTracking21View");
            var etList = expenseTracking.getValue();
            var count = etList.length;
            if (count == 1) {
                var etRow1 = etList[0];
                workflowMessage.updateValues(etRow1);
                return true;
            }
        }
        else if (conditionName === 'MANY_ROWS') {
             return false;  //ie do the normal navigation which is to go to the listview screen
        }
    }
    // default case is to NOT change the flow
    return false;
}