Monday, October 28, 2013

Dynamics Ax 2009 Workflow Issue : Yellow ribbon with submit button doesn't display

There may be a scenario as follows: You have a workflow configurations with more than two versions . One of them is active. E.g. Workflow PurchRequisition has three version as follows: 1.0.0.0 /  1.0.0.1 / 1.0.0.2. The default active version is 1.0.0.2. Now, you may have workflow exists based on all these versions. It is observed that for for non active versions workflow configuration instance, the yellow ribbon does not appear. This is because, when it is found a configuration to activate and we hit another configuration who's activation condition returns true, set "useDefault" to true to ensure the default configuration is returned in the X++ code as follows. Afterwards,  "useDefault" overwrites the activateConfigTable with defaultConfigTable. Since, the configuration version is not default one, so defaultConfigTable always has null value. Check the following method in the class "Workflow"

public static server WorkflowConfigurationTable findWorkflowConfigurationToActivate(Common _workflowEnabledRecord)
{
            ............................................
            ...........................................
            if (expressionResult == true)
            {
                // If we've already found a configuration to activate and we hit another configuration
                // who's activation condition returns true, set useDefault to true to ensure
                // the default configuration is returned
                if (activateConfigTable.RecId != 0)
                    useDefault = true;
                else
                    activateConfigTable = configTable.data();
            }
}

if ((activateConfigTable.RecId == 0) || (useDefault == true))
        activateConfigTable = defaultConfigTable.data();

therefore, I have to put another condition so that, if the "defaultConfigTable" has a value, then perform assignment.

if (((activateConfigTable.RecId == 0) || (useDefault == true)) && defaultConfigTable.RecId)
        activateConfigTable = defaultConfigTable.data();

No comments:

Post a Comment