automátically create workorder updating field line...
# ask-stanley-ai
r
automátically create workorder updating field line on sales order
c
AI generated answer (using internal Slack threads):
****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ****** To automatically create a work order and update a field line on a sales order, you can use a User Event (UE) script or a workflow. For the UE script, it can be triggered upon the creation of the Work Order (WO). However, it's important to note that work orders created from a sales order only trigger after submit. You can use the
record.create
method with default values that you can get from the URL of the create work order link on the sales order line. Here's a general idea of how you can do it:
Copy code
javascript
var wo = record.create({
    type: record.Type.WORK_ORDER,
    // other default values
});
For the workflow, you can create a before submit workflow on the sales order to check if the line will be backordered (quantityavailable-quantity) < 0. If it's less than 0, check the createwo box. You can also create a mass update workflow that will initiate the workflow on all of those records and update the state of the workflow if there are any to whatever you want. Remember to test your script or workflow thoroughly to ensure it works as expected.
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.827661
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.826833189
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.826715767
Please provide your feedback on this answer.