Home > Dynamics Ax > Workflow approval pending records from Ax User Login

Workflow approval pending records from Ax User Login


The following example gives an idea about how we can see the Workflow approval pending records, from a particular user Login.

In this example, I want to know, which all the ProjProposal Invoice records are pending for workflow approval process from my login Id.

static void WFApprRecordsFromUser(Args _args)
{
    QueryBuildDataSource    qbds, qbds1;
    QueryBuildRange         qbr;
    Query                   query = new Query();
    QueryRun                qr;
    ProjProposalJour        projProposalJour;
    ;

    qbds = query.addDataSource(tablenum(ProjProposalJour));
    qbds.clearRanges();
    qbds.clearLinks();

    qbds1 = qbds.addDataSource(tablenum(WorkflowWorkItemTable));
    qbds1.addLink(fieldnum(ProjProposalJour, RecId), fieldnum(WorkflowWorkItemTable, RefRecId));
    qbds1.addRange(fieldnum(WorkflowWorkItemTable, RefTableId)).value(QueryValue(tablenum(ProjProposalJour)));
    qbds1.addRange(fieldnum(WorkflowWorkItemTable, Status)).value(QueryValue(WorkflowWorkItemStatus::Pending));
    qbds1.addRange(fieldnum(WorkflowWorkItemTable, UserId)).value("santo");
    qbds1.joinMode(joinmode::ExistsJoin);

    qr = new QueryRun(query);

    while (qr.next())
    {
        projProposalJour = qr.getNo(1);
        print projProposalJour.RecId;
    }
    pause;
}

PartySmile

Advertisements
Categories: Dynamics Ax
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: