web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

X++ : Workflow Work Item Business event Payload Extension

(1) ShareShare
ReportReport
Posted on by
Hi All,
 
My goal is to extend the standard business event payload /BusinessEventWorkflowWorkItem/ so that I can add a list of previous steps in the WF.
 
I can create the methods to set the new fields, but I cannot extend the Initialize method, as you can see in the screenshot, with the message /The next cannot be invoked in the method /Initialize/ because it is not in a Cain Of Command method).
 
My first idea was also to extend the /BusinessEventWorkflowWorkItem/ class, specifically the buildContract() method, but it is Internal and therefore it is not possible to do so.
 
Has anyone ever faced a similar problem?
Do you have a solution to achieve my goal or do you suggest I create specific business events (with the desired payload) and launch them at the WFs I am interested in?
 
Thanks in advance, 
Luca
I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    239,684 Most Valuable Professional on at
    There is no BusinessEventWorkflowWorkItem class, but you surely mean BusinessEventsWorkFlowWorkItem class.
     
    It indeed doesn't have any initialize() method, therefore an attempt to extend it must fail.
     
    The article (in the part covering design of new business events) suggests creating initialize() method and calling it from a factory method (newFromCustInvoiceJour()). An equivalent of this in BusinessEventsWorkFlowWorkItem is creating a method like initialize() and calling it from a CoC extension of construct().
  • CU19081013-0 Profile Picture
    on at
    Hi Martin,
     
    Thanks for the feedback. Yes I mean the BusinessEventsWorkFlowWorkItem class.
    An equivalent of this in BusinessEventsWorkFlowWorkItem is creating a method like initialize() and calling it from a CoC extension of construct().
    Ok for the Initialize method, but I cannot extend the construct() of the class, since it is an internal one. 
    Or did I get something wrong?
     
    After your answer, however, I start thinking about other solutions and my new idea is to create a new custom business event and trigger it in the same spot where the BusinessEventsWorkFlowWorkItem is triggered.
    Also there, the issue is that the methods that trigger this business event are private so I cannot develop my solution.
    Have you any suggestions also on this, please?
     
    Thanks in advance,
    Luca
  • Martin Dráb Profile Picture
    239,684 Most Valuable Professional on at
    construct() is public - I verified it. What I didn't notice was that the whole idea of extending this class can't work, because the class itself is internal.
     
    If I was you, I would think carefully whether your technical solution (adding previous steps to the payload) is the right approach to the business requirement. Payload should be lightweight and easy to populate. Consider keep it as it is and exposing a web service with additional details. When (only when) the business event is subscribed to and processed by someone who needs additional details, he'll call the web service to fetch them.
  • CU19081013-0 Profile Picture
    on at
    My requirement is to provide the list of previous approvers within the mail that the current approver will receive.
    To do this, we thought of a Power Automate flow, triggered by the WF business event, which sends an email to the current approver, with this information.
     
    In your opinion and your experience, could it be easier and technically correct to create a special action to expose this information in the "WorkflowWorkItems" entity?
     
    In that way, the payload will remain the same and the information will be retrieved at the needed.
  • Suggested answer
    CU19081013-0 Profile Picture
    on at
    Hi Martin,
     
    thanks to your suggestion, I revised the solution and opted to create a custom action in an entity to be able to retrieve this information.
    This way I will not burden the business event payload and will have the information on demand.
     
    The only cons of this solution might be slowing down the flow of Power Automate due to the execution of the action.
    Still, I think this is reasonable compared to burdening the payload of each business event for workflow work items.
     
    Do you know of any other cons to this that I am missing?

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.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Abhilash Warrier Profile Picture

Abhilash Warrier 681 Super User 2026 Season 1

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 598 Super User 2026 Season 1

#3
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 579

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans