Показать сообщение отдельно
Старый 25.08.2023, 20:14   #1  
Blog bot is offline
Blog bot
Участник
 
25,488 / 846 (79) +++++++
Регистрация: 28.10.2006
dynamicsaxinsight: D365FO: Get last workflow approver for purchase orders in X++
Источник: https://dynamicsaxinsight.wordpress....e-orders-in-x/
==============

Purpose:

In this post we’re going to see how can we get last workflow approver for purchase orders in X++.

Application:

Dynamics 365 for Finance and Operations.

Business requirement:

Get the last purchase order approver in X++.

Solution:

Please use the code below to get the last purchase order approver.

Tip:

Take a note that workflow tables are cross-company tables. That’s why it is important to change company when making joins with them, else you will get empty table buffers!

Code

/// /// Gets workflow last approver for purchase orders./// public void getPurchWorkflowApprovers(){ WorkflowTrackingStatusTable workflowTrackingStatusTable; WorkflowTrackingTable workflowTrackingTable; PurchTable purchTable; PurchTable purchTableWTT; while select crosscompany purchTable { changecompany(purchTable.DataAreaId) { select firstonly crosscompany workflowTrackingTable order by workflowTrackingTable.RecId desc join workflowTrackingStatusTable where workflowTrackingTable.WorkflowTrackingStatusTable == workflowTrackingStatusTable.RecId join purchTableWTT where workflowTrackingStatusTable.ContextTableId == tableNum(PurchTable) && workflowTrackingStatusTable.ContextCompanyId == purchTableWTT.DataAreaId && workflowTrackingStatusTable.ContextRecId == purchTableWTT.RecId && workflowTrackingTable.TrackingContext == workflowtrackingcontext::WorkItem && workflowTrackingTable.TrackingType == workflowtrackingtype::Approval && purchTableWTT.RecId == purchTable.RecId; info(strFmt("%1, %2", purchTable.PurchId, workflowTrackingTable.User)); } }}


Источник: https://dynamicsaxinsight.wordpress....e-orders-in-x/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.