This question has been flagged

Hi. I'm trying to set an automated action in the Sales Order model that creates a new sales order line (for an existing product) every time I add a specific sales order line with the product_template_id called Project A.

For example, when I create a new sales order and then add the product Project A, and then save it, it should automatically add the product Set Up to my lines. 

I configured the automated actions like this:

Model: Sales Order Line

Trigger: On Update

Apply on: Match records with the rule: "Product Template>Name=Project A"

Action To Do: Create a New Record

Target model: Sales Order Line

Data to Write:
​Field: Order Reference (Sales Order Line)
​Evaluation Type: Python expression

​Field: Product Template (Sales Order Line)
​Evaluation Type: Reference
​Record: Set Up
​Value: 6


With this configuration, I encounter the following issue: 

Missing Record: Record does not exist or has been deleted (Record: sale order(145), User: 14


I have been testing, and I can't get this to work. Could someone help me? Thank you.

Best Answer


It seems like the issue might be related to how the automated action is triggered and the configuration of the action itself. Here's how you can troubleshoot and potentially fix the problem:

  1. Trigger Condition: Instead of using "On Update" as the trigger condition, consider using "On Create" or "Before Update" depending on your specific requirements. This ensures that the action is triggered when a new sales order line is created or updated, which is likely when you want the Set Up product line to be added.
  2. Apply On Condition: Ensure that the "Apply on" condition is correctly set to "Match records with the rule: Product Template > Name = Project A". This ensures that the action is applied only to sales order lines with the specified product template.
  3. Data to Write: Check the values you are providing for the "Order Reference" and "Product Template" fields. Ensure that the "Order Reference" field is correctly mapped to the sales order line's order reference, and the "Product Template" field is set to the correct product template ID for the Set Up product.
  4. Record and Evaluation Type: Verify the evaluation type for each field. For the "Order Reference" field, use the Python expression to correctly reference the sales order's ID. For the "Product Template" field, ensure that you're providing the correct product template ID for the Set Up product.
  5. Error Message: The error message "Missing Record: Record does not exist or has been deleted" suggests that there might be an issue with retrieving the sales order record or the Set Up product record. Double-check that the records exist and that the IDs provided in the automated action are correct.

By reviewing and potentially adjusting these aspects of the automated action configuration, you should be able to resolve the issue and have the Set Up product line automatically added to sales order lines with the Project A product template.

Hope it helps