How would I do a suiteql join on a manufacturingOp...
# ask-stanley-ai
r
How would I do a suiteql join on a manufacturingOperationTask record to an item on a workorder
c
AI generated answer (using internal Slack threads):
Based on the conversations, to do a SuiteQL join on a
manufacturingOperationTask
record to an item on a work order, you would need to create a search with the type
manufacturingoperationtask
and join it with the
workOrder
using the
itemid
field. Here is a sample code:
Copy code
javascript
var manufacturingoperationtaskSearchObj = search.create({
    type: "manufacturingoperationtask",
    columns: [
        search.createColumn({
            name: "workorder",
            sort: search.Sort.ASC,
            label: "Work Order"
        }),
        search.createColumn({name: "sequence", label: "Operation Sequence"}),
        search.createColumn({name: "name", label: "Operation Name"}),
        search.createColumn({
            name: "itemid",
            join: "workOrder",
            label: "Item"
        })
    ]
});
var searchResultCount = manufacturingoperationtaskSearchObj.runPaged().count;
log.debug("manufacturingoperationtaskSearchObj result count",searchResultCount);
manufacturingoperationtaskSearchObj.run().each(function(result){
    var assembly = result.getValue({
        name: 'itemid'
    });
    return true;
});
In this code, the
manufacturingoperationtask
search object is created with the type
manufacturingoperationtask
. The columns include
workorder
,
sequence
,
name
, and
itemid
which is joined with
workOrder
. The search is then run and each result is processed. The
itemid
value is retrieved for each result. Please note that the
itemid
field might return null if you are looking for the shown text, not the reference number. In that case, you might need to adjust your code accordingly. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.817851543
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.812857509
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.810411096
Please provide your feedback on this answer.