Notifications
Announcements
No record found.
{ "_payload": { "Id": "6d4d4a1c-e0e2-4173-8ebf-c18f6dd0caf5", "MenuItemName": "PurchTable", "RefRecId": 5637660841, "RefTableId": 27271, "TableName": "PurchTable", "DocumentNumber": "PO800313", "RootCorrelationId": "aaf651f9-61b9-486d-ad8d-10e07eea04h7", "outcome": "RequestChange" } }
public static void main(Args _args) { WorkflowWorkItemTable workItem; WorkflowComment comment = "Dears, please update the total.."; WorkflowWorkItemActionType actionType = WorkflowWorkItemActionType::RequestChange; MenuItemName menuItem = 'PurchTable'; Guid _workItemId = str2Guid("6d4d4a1c-e0e2-4173-8ebf-c18f6dd0caf5"); workItem = WorkflowWorkItemTable::find(_workItemId); if (!workItem.RecId) { throw error(strFmt("Work item %1 not found.", _workItemId)); } if (workItem.Status != WorkflowWorkItemStatus::Pending) { throw error("Work item is not pending."); } comment = strFmt("@ApplicationFoundation:ExternalWorkitemCompletionTag", comment); WorkflowWorkItemActionManager::dispatchWorkItemAction( workItem, comment, workItem.UserId, actionType, menuItem ); info("Request change action completed."); }
Hi there 👋
Thanks for your question!
When updating the workflow status using a custom service API like RequestChange(payload), it's important to ensure consistency across all related tables and workflow components to avoid side effects.
RequestChange(payload)
✅ Here are key considerations:
Update the workflow work item status Yes, you should update the status of the workflow work item itself using the appropriate workflow framework methods (e.g., WorkflowWorkItemTable).
WorkflowWorkItemTable
Update the header table (e.g., PurchTable) If your workflow logic relies on the ApprovalStatus field in PurchTable, you should update it to reflect the new status (RequestChange). This ensures that UI components and reports show the correct status.
ApprovalStatus
PurchTable
RequestChange
Update related line tables if applicable If your workflow spans line-level data (e.g., PurchLine), and those lines have their own approval status fields, you should update them as well—especially if business logic or validations depend on it.
PurchLine
Trigger workflow events properly Use the workflow runtime APIs to trigger status changes rather than manually updating fields. This ensures that all workflow history, tracking, and notifications are handled correctly.
Audit and history tracking Make sure any changes are logged appropriately in workflow history tables (e.g., WorkflowTrackingTable) to maintain traceability.
WorkflowTrackingTable
Test thoroughly Always test in a sandbox environment to ensure that the workflow behaves as expected and that no orphaned or inconsistent records are created.
Hope this helps! ✅ Please mark this reply as helpful if it answered your question. Best regards! 👋
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Dráb 664 Most Valuable Professional
André Arnaud de Cal... 522 Super User 2025 Season 2
Sohaib Cheema 303 User Group Leader