Fetch the userid who approved the workflow:

Hi,

In AX 2012:

Below code fetches the user id’s who approved the PO workflow.

select firstonly workflowtrackingstatustable
join workflowtrackingtable
where workflowtrackingstatustable .ContextRecId == purchtable.recid
&& workflowtrackingtable.TrackingContext == workflowtrackingcontext::WorkItem
&& workflowtrackingtable.TrackingType == workflowtrackingtype::Approval
&& workflowtrackingtable.WorkflowTrackingStatusTable == workflowtrackingstatustable .recid;
{
approvername = workflowtrackingtable.User;
}

this code might help you to get a PO approver(in the same way you can get the approver name of any order/ journal
by passing the approved record id as context rec id).
Note:
In case there are multiple approvers use While to select multiple approver user id’s from workflowtrackingstatustable.

In AX 2009:

Below code fetches the user id’s who approved the PO workflow.

select firstonly workflowtrackingtable order by recid asc
where workflowtrackingtable.ContextRecId == purchtable.recid
&& workflowtrackingtable.TrackingContext == workflowtrackingcontext::WorkItem
&& workflowtrackingtable.TrackingType == workflowtrackingtype::Approval;
if (workflowtrackingtable)
{
approvername = workflowtrackingtable.User;
}

this code might help you to get a PO approver(in the same way you can get the approver name of any order/ journal
by passing the approved record id as context rec id).
Note:
In case there are multiple approvers use While to select multiple approver user id’s from workflowtrackingtable.

Advertisements

3 thoughts on “Fetch the userid who approved the workflow:

  1. We have decided to open our POWERFUL and PRIVATE web traffic system to the public for a limited time! You can sign up for our UP SCALE network with a free trial as we get started with the public’s orders. Imagine how your bank account will look when your website gets the traffic it deserves. Visit us today: http://voxseo.com/traffic/

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