Announcements
No record found.
Hi everyone,
I have successfully implemented a requirement to allow users to insert dynamic field placeholders (e.g., %CustTable.AccountNum%) into both the Subject and Message body of an Alert Rule.
%CustTable.AccountNum%
I’m sharing the logic I used to see if there are any recommended improvements or if this helps anyone else facing the same requirement.
Standard D365 F&O alerts allow static text in the subject and message. However, users often want the email to contain specific record data (like Customer Name, Document ID, or Amount) without manually typing technical field names.
Form Extension (EventCreateRule): - Added two unbound String Controls (Sunb_Placeholder and Sunb_PlaceholderMsg) with LookupButton = Always.
EventCreateRule
Sunb_Placeholder
Sunb_PlaceholderMsg
LookupButton = Always
Used a FormControlEventHandler to intercept the Lookup event.
FormControlEventHandler
Lookup
Within the lookup, I use SysDictTable and SysDictField to iterate through the metadata of the Alert's context table (EventRule.PrimTableId) and populate a temporary buffer with the format %TableName.FieldName%.
SysDictTable
SysDictField
EventRule.PrimTableId
%TableName.FieldName%
UI Integration (OnModified):
OnModified
When a value is selected from the lookup, the Modified event triggers.
Modified
The code snatches the selected placeholder and appends it directly to the EventRule.Subject or EventRule.Message table buffer and refreshes the datasource.
EventRule.Subject
EventRule.Message
The picker control is then reset to a label "Insert Placeholder" to act as a reusable button.
Email Processing (EventInbox Extension):
EventInbox
Created an extension of the EventInbox.insert() method.
EventInbox.insert()
After the alert is created, the code identifies the source record using this.AlertedFor (RecId) and this.TableId.
this.AlertedFor
this.TableId
A static string-parsing method scans for %...% patterns and uses reflection to replace them with the actual values from the source record buffer before the email is sent.
%...%
Handling the ManagedEventArgs error by avoiding cancelDefault() and relying on the system's redirection.
ManagedEventArgs
cancelDefault()
Updating the Rich Text/HTML Message field directly via the buffer to ensure the UI updates correctly.
Ensuring the code is generic enough to work for any table context (Customers, Sales Orders, Vendors, etc.).
Has anyone implemented a similar placeholder engine? I'm curious if there are better ways to handle the string replacement during high-volume alert processing.
Clear Context: You explain the "Why" (The Scenario).
Structured Solution: You break it down into Form, UI, and Table levels.
Community Engagement: You end with a question, which encourages experts to reply and boost your post's visibility.
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 2026 Super Stars!
We are thrilled to have these Champions in our Community!
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Giorgio Bonacorsi 688
André Arnaud de Cal... 524 Super User 2026 Season 1
CP04-islander 301