Thursday, 3 March 2016

How to Get Workflow Instance Number Based on Journal Number in Ax 2009

static void JournalNumBase_InstanceNum(Args _args)
{
    ledgerjournaltable          ledgerjournaltable;
    workflowtrackingtable       workflowtrackingtable;
    workflowtrackingstatustable workflowtrackingstatustable;
    Recid           recid;
    //CorrelationId   CorrelationId;
    guid            CorrelationId;

    select  Recid from ledgerjournaltable where ledgerjournaltable.JournalNum=="JN-000247" ;
    recid = ledgerjournaltable.RecId;

    select  workflowtrackingtable where workflowtrackingtable.ContextRecId == recid;
    CorrelationId = workflowtrackingtable.CorrelationId;

    select  workflowtrackingstatustable where workflowtrackingstatustable.CorrelationId ==CorrelationId;

    info(strfmt("Instance id %1 ",workflowtrackingstatustable.InstanceNumber));


}

No comments:

Post a Comment