Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

Place in code for inserting WorkflowWorkItemTable

(0) ShareShare
ReportReport
Posted on by

I'm trying to debug the standard PurchReqApproval Workflow (WF) (AX2009).

As soon as I summited the Purchase Requisition to WF (and if WF batch has been setup correctly) the two classes (SysWorkflowMessageQueueManager and WorkflowWorkItemDueDateJob) start to process the WF "instances".

Anyhow, the WorkflowWorkItemDueDateJob class do processes a records of WorkflowWorkItemTable and I can't find a place in the code, where the record of WorkflowWorkItemTable is being inserted.
I've overridden the WorkflowWorkItemTable.insert() and WorkflowWorkItemTable.update() methods, I put a breakpoints to those places where I think the WorkflowWorkItemTable buffer is being filled but with no luck.

So the question is - where (in the code) the record to WorkflowWorkItemTable is being inserted?

  • Suggested answer
    Community Member Profile Picture
    on at
    RE: AX2009 Workflow. Place in code for inserting WorkflowWorkItemTable

    So, the record to the WorkflowWorkItemTable table (I think) do inserts by BusinessConnector.

    This is the only pleace in Microsoft.Dynamics.Framework.Workflow.BusinessConnector dll where the WorkflowWorkItemTable can be found

     

    namespace Microsoft.Dynamics.Framework.Workflow.BusinessConnector

     

    [SuppressMessage("Microsoft.Design", "CA1054")]

        [SuppressMessage("Microsoft.Design", "CA1011")]

        [SuppressMessage("Microsoft.Design", "CA1062")]

        [SuppressMessage("Microsoft.Naming", "CA1719")]

        public static SysWorkflowWorkItemContext newWorkflowWorkItemContextFromWorkItem(

          IAxaptaAdapter axaptaAdapter,

          IAxaptaRecordAdapter _workflowWorkItemTable)

        {

          SysWorkflowWorkItemContext workflowWorkItemContext = (SysWorkflowWorkItemContext) null;

          object obj = axaptaAdapter.CallStaticClassMethod(ProxyObjectBase.ProxyClassName.op_Explicit(SysWorkflowWorkItemContext.cClassName), nameof (newWorkflowWorkItemContextFromWorkItem), _workflowWorkItemTable.AxaptaRecord);

          if (obj != null)

            workflowWorkItemContext = new SysWorkflowWorkItemContext(axaptaAdapter, axaptaAdapter.CreateAxaptaObject(obj));

          return workflowWorkItemContext;

        }

     

    I have tried to search WorkflowWorkItemTable in the following dlls:

    Microsoft.Dynamics.Framework.Workflow.BusinessConnector.dll

    Microsoft.Dynamics.Framework.Workflow.Communication.dll

    Microsoft.Dynamics.Framework.Workflow.dll

    Microsoft.Dynamics.Framework.Workflow.WebServices.dll

     

    Anyway the problem was not in the dll rather then in settings:

     

    In general, the architecture of the Workflow for AX2009  is the following:

    1. AX -> call some functionality (dll) which is executed on IIS
    2. In it’s turn the IIS call some functionality in AX thought the Business Connector

    So, there are two components that should be checked: settings in AX and in IIS (for Business Connector)

    1. In AX, navigate to Administration/Setup/Workflow infrastructure configuration wizard
      1. Click Next button one time and you’ll be able to see the Workflow runtime URL (in my case it’s http://MyServerNameDEVAX01:80/WorkflowTest) – this is the location of you web site (on IIS) which executes some logic for the Workflow
    2. Next – you need to navigate to the Web.Config on your IIS.

    IIS_5F00_BusinessConnector_5F00_2.jpg

    3. As you can see from the picture above, the Web.Config has been modified by adding this line

    <add key="BUSINESS_CONNECTOR_CONFIGURATION" value="C:\AX\AXC\dev.axc" />

    So make sure, that the dev.axc file is really exists in the “C:\AX\AXC” folder.

     

    Some tips, that may help you:

    How to: Debug X++ Code in Workflow

    docs.microsoft.com/.../dd638052(v=ax.50)

     

    To debug X++ code in Microsoft Dynamics AX 2009 workflow, you must first set up the development environment. Because the workflow runtime executes X++ code by using the RunAsPermission Class and debugging is not supported in the RunAsPermission class user session, you must disable this feature for debugging. The following procedure describes how to enable debugging in the workflow runtime development environment.

     

    By default, debugging is not enabled in Microsoft Dynamics AX. To enable debugging on the Application Object Server (AOS) and the client, see How to: Enable the Debugger.

    To configure Workflow for debugging

    In the Application Object Tree (AOT), expand the Macros node, right-click Workflow, and then click Edit. The X++ Code Editor window opens.

    In the Code Editor, scroll to the bottom and change the value found in the following line from #define.WorkflowRunAsDebug(false) to #define.WorkflowRunAsDebug(true). This disables the RunAsPermission class feature and the X++ code executes directly on the workflow system account instead of on the user session. You may be required to change the workflow system account to a user who has Administrator user rights.

    Press CTRL+S to save the changes, and then close the Code Editor window.

    In the AOT, expand the Classes node, right-click the SysWorkflowHelper Class, and then click Edit.

    In the Code Editor, click the Compile icon, and then close the Code Editor window. The debugger is now enabled for workflow.

    After debugging, make sure that you reset the value in the Workflow macro to false and recompile the SysWorkflowHelper class to restore system security for workflow.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,027 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,852 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans