how to get the assembly item name on the bom revis...
# ask-stanley-ai
h
how to get the assembly item name on the bom revision saved search
c
AI generated answer (using internal Slack threads):
To get the assembly item name on the BOM revision saved search, you can create a search on the 'bomrevision' record type and join upwards to the assembly item. Here is a sample code using the analytics/query module:
Copy code
javascript
function createAdvancedBomQuery() {
    var queryMain = query.create({
        type: 'bomrevision'
    });
    var conditionOne = queryMain.createCondition({
        fieldId: 'billofmaterials.bomassemblylocation.ismasterdefaultbom',
        operator: <http://query.Operator.IS|query.Operator.IS>,
        values: true
    });
    var conditionTwo = queryMain.createCondition({
        formula: 'CASE WHEN NVL({effectivestartdate},CURRENT_DATE) <= CURRENT_DATE AND NVL({effectiveenddate},CURRENT_DATE) >= CURRENT_DATE THEN 1 ELSE 0 END',
        operator: query.Operator.EQUAL,
        values: 1,
        type: query.ReturnType.INTEGER
    });

    queryMain.condition = queryMain.and(conditionOne, conditionTwo);
    var tempColumns = [
        {
            fieldId: 'billofmaterials.bomassemblylocation.assembly'
        },
        {
            fieldId: 'component.item'
        },
        {
            fieldId: 'component.bomquantity'
        },
        {
            fieldId: 'component.item^item.itemtype'
        }
    ]
    queryMain.columns = [];
    for (var i in tempColumns) {
        queryMain.columns.push(queryMain.createColumn(tempColumns[i]));
    }
    return queryMain;
}
This function creates a query on the 'bomrevision' record type and adds conditions to filter for the default BOM and the current date. It then adds columns for the assembly item, component item, BOM quantity, and item type. The results of this query will give you the assembly item name along with other details. Remember to use
queryMain.run().asMappedResults()
to turn your resultSet into a readable object with properties of whatever aliases you gave each column. ****** 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.845062196
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.831602514
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.826748252
Please provide your feedback on this answer.