Dear all,

In my workflow config, there will be only ONE approver after submitted.

But i want to know the approver before submit it

So i wrote a job like below:

static void getApproverTest(Args _args)

{

    MyTable                 myTable;

    container               con;

    WorkflowCorrelationId   workflowCorrelationId;

    WorkflowWorkItemTable   workflowWorkItemTable;

    WorkflowTrackingStatusTable     statusTable;

    ;

    myTable = MyTable::find("IS00001"); 

    ttsbegin; 

    workflowCorrelationId = Workflow::activateFromWorkflowTemplate("MyWorkflowTemplate",

                                                                  myTable.RecId,

                                                                   "Testing",

                                                                   NoYes::No); 

    select firstonly statusTable

            order by CreatedDateTime, RecId desc

        where statusTable.ContextTableId == _tableId

           && statusTable.ContextRecId == _recId;

 

    if (statusTable)

    {      

        select firstonly trackingTableApproval        //seems the workitem & approval didn't insert yet... only have ONE submit record here

                order by CreatedDateTime, RecId desc   //the other record seems need do ttscommit and then case see it

            where trackingTableApproval.CorrelationId == statusTable.RootCorrelationId

               && trackingTableApproval.TrackingContext == workflowTrackingContext::WorkItem

               && trackingTableApproval.TrackingType == workflowTrackingType::Approval;

 

         .......

         User = trackingTableApproval.User;  //so here will be return "";

    } 

    ttsabort; //

}