this returns empty even though there is a column w...
# ask-stanley-ai
n
this returns empty even though there is a column with that name mySearch.run().each(function(result) { var currItem = result.getValue({name: 'internalid'});
c
AI generated answer (using internal Slack threads):
Based on the conversations, it seems like the issue is related to how the
getValue
function is being used in SuiteScript. When you are trying to get the value of a field from a joined search, you need to pass the
join
parameter in the options object. For example, in the first conversation, the issue was that the
getValue
function was trying to get the value of 'itemid' directly, but 'itemid' was a field in a joined search. The correct way to get the value would be:
Copy code
javascript
var assembly = result.getValue({
    name: 'itemid',
    join: 'workOrder'
});
In the second conversation, the issue was that the search was created but not run. The correct way to get the value would be:
Copy code
javascript
var assigneeID = search.create({
    type: "employee",
    filters: [["entityid","is",assigneeName]],
    columns: [search.createColumn({name: "internalid", label: "Internal ID"})]
});

var assigneeInternalId;
assigneeID.run().each(function (result) {
    assigneeInternalId = result.id
    return false;
});
In the third conversation, the issue was similar to the first one. The correct way to get the value would be:
Copy code
javascript
var customerId = result.getValue({
    name: 'internalid',
    join: 'customerMain'
});
****** 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.853459716
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.84974587
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.849352956
Please provide your feedback on this answer.