How to Build Custom Actions in SyteLine
Custom actions in SyteLine extend the user interface with purpose-built operations that users can trigger from toolbar buttons, context menus, and form events. Actions bridge the gap between user interactions and server-side processing by packaging IDO method calls, parameter collection, and result handling into reusable components. This guide walks through creating custom actions from definition to deployment, including multi-record operations and confirmation dialogs.
Defining Custom Actions in the Action Designer
Custom actions are created through Application Development > Action Designer, where you define the action's properties, parameters, and execution behavior. Each action has a unique ActionID, display name, and associated icon that appears on toolbar buttons or context menus. Specify the target IDO and method that will execute when the action is invoked, along with any input parameters that need to be collected from the user. The Action Designer supports several execution modes: SingleRecord for operations on the currently selected record, MultiRecord for batch operations on selected grid rows, and NoRecord for global operations that do not require a record context.
- Open Application Development > Action Designer and create a new action with a unique ActionID, display name, tooltip text, and icon selection
- Configure the target IDO and method name that will execute when the action is triggered, such as SLCustomerOrders.ApproveOrder
- Define input parameters with UI labels, data types, and default values to create a parameter collection dialog that displays before execution
- Set the ExecutionMode to SingleRecord, MultiRecord, or NoRecord based on whether the action operates on specific records or globally
Adding Actions to Forms and Menus
After defining a custom action, attach it to forms by opening the target form in Form Designer and adding the action to the form's ActionCollection. The action appears as a toolbar button, a context menu item, or both, depending on your configuration. For toolbar placement, set the ToolbarGroup and ToolbarPosition properties to control where the button appears relative to standard SyteLine toolbar buttons. For context menus, add the action to the form's ContextMenuActionCollection with appropriate visibility conditions. You can conditionally enable or disable actions based on record state by setting the EnableExpression property to a boolean expression that evaluates against current IDO property values.
- Open the target form in Form Designer and navigate to the ActionCollection property to add your custom action by referencing its ActionID
- Configure ToolbarGroup (e.g., 'Custom' or 'Operations') and ToolbarPosition (integer) to control button placement in the form toolbar
- Add actions to ContextMenuActionCollection for right-click access, setting ShowInContextMenu = true and configuring display position
- Set EnableExpression to conditionally activate actions, such as Status = 'Ordered' AND TotalAmount > 0 to prevent execution on invalid records
Implementing Multi-Record Actions and Confirmation Flows
Multi-record actions process multiple selected grid rows in a single operation, useful for batch approvals, status updates, and mass data modifications. Configure the action's ExecutionMode to MultiRecord and implement the server-side IDO method to accept and process a collection of record identifiers. Add a confirmation dialog by setting the ConfirmationMessage property, which displays a Yes/No prompt before execution with a customizable message that can include record count and operation description. For long-running multi-record operations, implement progress reporting in your IDO method to provide feedback to the user through the action's progress indicator.
- Set ExecutionMode to MultiRecord and implement the IDO method to accept an array of record keys from the grid selection
- Configure ConfirmationMessage with dynamic text like 'Process {SelectedCount} records? This action cannot be undone.' for user confirmation
- Implement progress reporting in the IDO method using SetActionProgress(current, total, statusMessage) for operations exceeding 5 seconds
- Handle partial failures by collecting error details for failed records and returning a summary result showing succeeded, failed, and skipped counts
Frequently Asked Questions
What is the difference between a custom action and a form script button?
Custom actions are reusable server-side operations defined in the Action Designer that can be attached to multiple forms and menus. Form script buttons execute client-side JavaScript within a single form context. Actions provide better reusability, consistent execution regardless of the calling interface, and built-in features like confirmation dialogs, progress reporting, and multi-record support. Use actions for business operations and form scripts for UI-specific behavior like field visibility toggling.
Can custom actions be restricted by user role?
Yes, custom actions support role-based access control through SyteLine's security framework. Assign a SecurityResourceGroup to the action definition, then grant or deny access to specific user roles through Security > Role Maintenance. Users without access will see the action button grayed out or hidden depending on the SecurityBehavior setting. Approximately 70% of custom actions require role-based restrictions to prevent unauthorized operations like order approvals or price overrides.
How do I handle errors in multi-record custom actions?
Implement record-level try-catch blocks in your IDO method to isolate failures to individual records. Maintain counters for succeeded, failed, and skipped records, and collect error messages with the corresponding record identifiers. Return a structured result object containing the summary counts and detailed error list. Display the results to the user in a completion dialog showing '15 of 20 records processed successfully. 5 records failed due to validation errors.' This approach prevents one bad record from blocking the entire batch.
Key Takeaways
- 1Defining Custom Actions in the Action Designer: Custom actions are created through Application Development > Action Designer, where you define the action's properties, parameters, and execution behavior. Each action has a unique ActionID, display name, and associated icon that appears on toolbar buttons or context menus.
- 2Adding Actions to Forms and Menus: After defining a custom action, attach it to forms by opening the target form in Form Designer and adding the action to the form's ActionCollection. The action appears as a toolbar button, a context menu item, or both, depending on your configuration.
- 3Implementing Multi-Record Actions and Confirmation Flows: Multi-record actions process multiple selected grid rows in a single operation, useful for batch approvals, status updates, and mass data modifications. Configure the action's ExecutionMode to MultiRecord and implement the server-side IDO method to accept and process a collection of record identifiers.
Want to add powerful custom actions to your SyteLine forms? Netray delivers custom action development that streamlines user workflows and eliminates manual processing steps.
Related Resources
How to Create SyteLine Custom Forms
Step-by-step guide to creating custom forms in Infor SyteLine using the Form Designer, including layout configuration, data binding, and IDO integration for tailored ERP interfaces.
Infor SyteLineHow to Write SyteLine IDO Extension Classes
Learn how to write IDO extension classes in Infor SyteLine using C# and .NET to add custom business logic, validation rules, and data processing to your ERP system.
Infor SyteLineHow to Create SyteLine Custom Processes
Learn how to create custom background processes in Infor SyteLine for automated data processing, batch operations, and scheduled tasks using the Process Designer and IDO framework.