How to Process Selected Records in Dynamics 365 SysOperation Framework
Question details
The user needs to process only specific selected draft records via the Dynamics 365 SysOperation Framework, rather than updating all draft records in the system.

- Product
- Dynamics 365
- Device & OS
- not provided
- Scenario
- Executing a batch process or service from a form to update selected records from Draft to Confirmed.
- Observed behavior
- The SysOperation process changes every draft record instead of just the user-selected ones, and encounters issues when attempting to serialize table buffers or use the item() method on a Set class.
Ensure you have developer access to your Dynamics 365 environment and back up any ongoing X++ code changes in your version control system before modifying contracts or controllers.
Pass Selected Record Identifiers Through a SysOperation Contract
Use a contract class to pass the specific RecIds of the selected records to the service, ensuring only those selected in the form are updated.
Attempting to serialize a table buffer directly in a SysOperation contract is not supported and can lead to unexpected behaviors, such as updating all records. Instead, you should extract the record identifiers (RecIds) from the caller form and pass them as a list to the contract.
Modify your SysOperation contract class to accept a List of RecIds instead of a table buffer. Create the necessary parm methods to get and set this list.
In your controller class, use a selection helper (such as MultiSelectionHelper) to iterate through the data source of the caller form. Extract the RecId for each selected record.
Populate the List with the extracted RecIds and pass it to the contract object bound to your service execution.
In your service class, retrieve the List of RecIds from the contract. Iterate through the list using an Enumerator, retrieve each record, verify its status is Draft, select it for update, and change it to Confirmed. Be sure to add the SysEntryPoint attribute.

Need a Lightweight Office Suite for Your Development Documentation?
While troubleshooting Dynamics 365 X++ code, you might need a fast and reliable tool to draft technical documentation, flowcharts, or data export sheets. WPS Office provides a free, highly compatible alternative to Microsoft Office for all your document needs.
- 1. Visit the WPS Office Website: Navigate to the official WPS Office website to find the latest free version of the software suite.
- 2. Download for Your OS: Click the Free Download button and select the appropriate installer for Windows, Mac, or Linux.
- 3. Install and Document: Run the installer. Once completed, open WPS Writer or Spreadsheet to start drafting your X++ technical documentation seamlessly.

Frequently Asked Questions
Why does my SysOperation framework process update all records instead of selected ones?
This typically occurs when the controller does not correctly capture the selected records from the caller form's data source, or if the service class lacks specific criteria (like RecIds), causing it to execute a blanket update query.
Can I pass a table buffer directly in a Dynamics 365 SysOperation contract?
No, passing a table buffer directly in a contract is not supported because table buffers cannot be serialized. You must pass primary keys (such as RecId) to the contract instead.
How do I enforce that only Draft records are processed by my service?
Inside your service class method, add a conditional check (e.g., if the record status equals Draft) before executing the update logic. Additionally, enforce edit and delete restrictions at the table or form level so users can only initiate the process for valid records.




