4 Eylül 2020 Cuma

AX 2012 - Workflow form open error

 

At one of our customers Workflow wasn't opening. Also error message wasn't so much explaining:





After a review of Event log, couldn't find any log about this error. Tried all suggested solutions at web, still no success:

-Incremental CIL

-Full CL

-XppIL klasörünü silip AOS restart

-Full compile ve Full CIL

-Client reinstall


At a blog says there isn't inner CLR catch at try/catch in WorkflowEditorHost form. Like blogger did I decided add include these red lines to form:

 

private void build()
{
    #Admin
    #AOT
     //AGC memre
    #OCCRetryCount
    System.Exception ex;
    //AGC memre



    WorkflowVersionTable        versionTable;
    WorkflowTypeName            templateName;
    str                         domainUser;
    UserInfo                    userInfo;
    NumberSeq                   num;
    SysInfoAction_MenuFunction  sysInfoAction;
    TreeNode                    treeNode;
    SysDictWorkflowType            workflowType;
    int                         classId;

    num = NumberSeq::newGetNum(SysWorkflowParameters::numRefSequenceId(), false, true);
    if (num == null)
    {
        sysInfoAction = SysInfoAction_MenuFunction::newMenuItem(menuitemDisplayStr(SystemParameters), MenuItemType::Display);
        throw error("@SYS108268", '', sysInfoAction);
    }

    versionTable = element.args().record();

    //BP Deviation Documented
    select userInfo where userInfo.Id == curUserId();
    domainUser = userInfo.NetworkDomain + '\\' + userInfo.NetworkAlias;

    if (element.args().parmEnumType() == enumNum(WorkflowConfigurationActionType) &&
        element.args().parmEnum() == WorkflowConfigurationActionType::New)
    {
        templateName = element.args().parm();
        treeNode = TreeNode::findNode(#WorkflowTypesPath + #AOTDelimiter + templateName);

        if (treeNode)
        {
            workflowType = new SysDictWorkflowType(templateName);
            classId = className2Id(workflowType.document());
            if(classId == 0)
            {
                throw error("@SYS108554" + '. ' + "@SYS113219");
            }

            try
            {
                workflowConfiguration = Microsoft.Dynamics.AX.Framework.Workflow.Model.WorkflowModel::
                                            Create(templateName, curext(), curUserId(), domainUser);
            }
            catch (Exception::CLRError)
            {
            //AGC memre
            ex = ClrInterop::getLastException();
            if (ex != null)
            {
                ex = ex.get_InnerException();
                if (ex != null)
                {
                    error(ex.ToString());
                }
                else
                    error(AifUtil::getClrErrorMessage());
            }
            else
                    error(AifUtil::getClrErrorMessage());
            //AGC memre           
               
throw error("@SYS327400");
            }
        }
        else
        {
            throw error(strFmt("@SYS106830", templateName));
        }
    }
    else
    {
        try
        {
            workflowConfiguration = Microsoft.Dynamics.AX.Framework.Workflow.Model.WorkflowModel::Create(versionTable.ConfigurationId, curext(), domainUser);
        }
        catch (Exception::CLRError)
        {
            //AGC memre
            ex = ClrInterop::getLastException();
            if (ex != null)
            {
                ex = ex.get_InnerException();
                if (ex != null)
                {
                    error(ex.ToString());
                }
                else
                    error(AifUtil::getClrErrorMessage());
            }
            else
                    error(AifUtil::getClrErrorMessage());
            //AGC memre           
           
throw error("@SYS327400");
        }
    }

}





public void run()
{
    //AGC memre
    #OCCRetryCount
    System.Exception ex;
    //AGC memre

    try
    {
        modelEditorControl.Load(workflowConfiguration, userSettings);
        workflowEditorPane.initializeActionPane();
        if (element.args().openMode() == OpenMode::View)
        {
            isReadOnly = true;
            modelEditorControl.set_IsReadOnly(true);
            modifyElementButtonGroup.caption("@SYS322934");
            modifyWorkflow.caption("@SYS322935");
            viewToolboxButton.visible(false);
        }
    }
    catch (Exception::CLRError)
    {
    //AGC memre
        ex = ClrInterop::getLastException();
        if (ex != null)
        {
            ex = ex.get_InnerException();
            if (ex != null)
            {
                error(ex.ToString());
            }
            else
                error(AifUtil::getClrErrorMessage());
        }
        else
                error(AifUtil::getClrErrorMessage());
    //AGC memre
        throw error("@SYS327400");

    }

    super();
}

 

Then I could get a clear error message:

 



Looked inbound ports, reviewed Windows firewall, reviewed Ax32Serv.exe.config file, seem everything good. But client configuration tool still couldn't WCF refresh:

 


 

In spite of there is just one AOS at the computer, tried to write Instance Name:


 

Problem was solved: