Announcements
X++ code to fetch Purchase order assigned to the User. To fetch the Purchase order assigned to any particular User(Approver).
You may not get an answer here, this will mostly be Dynamics CRM users (Sales module).
Consider posting on this forum:
community.dynamics.com/.../microsoft-dynamics-ax-forum
Thank you Mike , I have posted in this forum.
Hi Anusuyashankar,
Check the old thread:community.dynamics.com/.../which-ax-database-table-has-workflow-assign-to-user-info. and focus on Jonathan's answer,
public display Responsible responsible() { WorkflowTrackingTable tracking; WorkflowTrackingStatusTable trackingStatus; WorkflowWorkItemTable workitem; Responsible ret = ""; UserInfo user; select tracking order by tracking.createdDateTime desc join trackingStatus where tracking.WorkflowTrackingStatusTable == trackingStatus.RecId && tracking.TrackingType != WorkflowTrackingType::Completion && ((tracking.TrackingContext == WorkflowTrackingContext::Step) || (tracking.TrackingContext == WorkflowTrackingContext::Task)) && trackingStatus.ContextTableId==this.TableId && trackingStatus.ContextRecId == this.RecId; select workitem where workitem.RefRecId == this.RecId && workitem.RefTableId == this.TableId && ((workitem.Status == WorkflowWorkItemStatus::Pending) || (workitem.Status == WorkflowWorkItemStatus::Delegated)); if ((tracking.RecId) && (workitem.UserId)) { select user where user.id==workitem.UserId; ret = strFmt("%1 (%2)", tracking.Name, user.name); } else if (tracking.RecId) { ret = strFmt("%1", tracking.Name); } return ret; }
Just need to replace "this" in the code with PurchTable.
Thank you Will Wu
can please say how to fetch description of the below field by using X++ code.
> Purchase Type
> Approval Status(purchtable.DocumentState)
>Purchase Order Status
Hi Anusuya,
Could you please clarify what you are referring to as description of the mentioned fields?
Can you tell about the business requirement here? What is the definition of a purchase order assigned to the user? Is it about a workflow assignment or purchaser field on the PO? Your question can be interpreted in various different ways.
the thing is I customized the purchase order and I need to bring the list of the users who created, verify, and approved the PO dynamically.
as the users who are dynamically shown in the PO report will be coming from the Workflow of the PO, as it very based on the PO created(initiator) and the approved by person.
I hope this is a clear question, as I will test and verify the above code if it works for me, please feel free to advise and direct me to a best practice way for ditching the data in the photo colored at the bottom.
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.
Congratulations to our community stars!
Expanding mentorship, skilling, and AI innovation
These are the community rock stars!
Stay up to date on forum activity by subscribing.
André Arnaud de Cal... 382 Super User 2026 Season 1
Martin Dráb 265 Most Valuable Professional
Subra 262