Hi Ilma, Thank you for sharing your requirement for conditional task routing in the OFBiz production module. This is a common challenge in dynamic manufacturing environments, and I’d be happy to share some insights to help you implement this functionality. Clarifying the Requirement
You’re looking to implement logic where tasks in a production run are selected dynamically based on runtime conditions (e.g., execute Task A if a quantity threshold is met, otherwise execute Task B). As you noted, features like manufacturing rules, product variants, and dependent production runs are typically used for product or component selection during BOM explosion, rather than task-level decision-making. Your focus on task routing requires a different approach. Proposed Solution One effective way to achieve conditional task routing is to customize the *getProductRouting* method in *RoutingServicesScript.groovy*. This method retrieves the routing and task list for a production run, making it a suitable place to introduce conditional logic. Here’s how you can approach it: 1. *Modify getProductRouting*: - Modify the method to evaluate runtime data (e.g., quantity thresholds stored in WorkEffort or a custom entity). - Use Groovy logic to dynamically filter or select tasks (WorkEffort records associated with the routing) based on your conditions. On Mon, Jun 23, 2025 at 4:46 PM Ilma masroor <ilmamasroor...@gmail.com> wrote: > Dear Apache OFBiz Community, > > I hope you're doing well. > > I am currently working on implementing *conditional task routing* within > the OFBiz production module, where certain tasks should be executed only > under specific conditions. For example: if a quantity check meets the > expected threshold, the system should execute *Task A*; otherwise, it > should proceed with *Task B*. This kind of branching logic is essential for > handling real-world manufacturing scenarios dynamically. > > While I have successfully implemented *nested routing*, allowing a task to > have sequential sub-tasks, the challenge lies in introducing *conditional > behavior* based on runtime data. > > I believe that OFBiz features like: > > - > > *Manufacturing rules* > - > > *Product variant definitions* > - > > *Dependent Production run configurations* > > …could be key components in solving this problem. However, I’m currently > struggling to determine how to best utilize these elements to define and > execute such conditional logic within the routing process. > > If anyone has experience implementing conditional task execution, or could > point me toward relevant documentation, examples, or best practices, I > would greatly appreciate your help. > > Thank you for your time and for the continued support and innovation within > this community. > > Best regards, > Ilma masroor > -- Kind Regards, Yashwant Dhakad HotWax Systems | www.hotwaxsystems.com