Dear Yashwant, Thank you very much for your detailed response and the insightful suggestion regarding the customization of the getProductRouting method in RoutingServicesScript.groovy. I truly appreciate the time you took to explain the approach and its practical application.
Before I proceed with modifying this core service, I wanted to ask whether there are any alternative methods available within the existing features of OFBiz version *18.12.19* that could support conditional task routing without altering the service layer. Specifically, I’m curious to know if any of the following elements could be leveraged to define conditional execution paths within a production routing: - *Manufacturing rules or condition expressions* within routing tasks - *Product or work effort attributes* evaluated at runtime - *Dependent production runs* that could act as conditional branches - Any existing *rule engines or configurable parameters* in the manufacturing module If any of these features—or others—can help achieve dynamic routing logic based on runtime data (such as quantity thresholds or product characteristics), I’d be very interested in exploring those options before proceeding with a service-level customization. Looking forward to your guidance and recommendations. Best regards, *Ilma Masroor* On Tue, Jun 24, 2025 at 2:20 PM Yashwant Dhakad < yashwant.dha...@hotwaxsystems.com> wrote: > 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 >