Last week I shared a NetSuite Suitelet that can be used to locate transactions and entities based on an external ID. I've received a lot of nice feedback about that blog post, and I really appreciate it.
Several readers wrote to me and asked if it would be possible to enhance the script so that it supports locating items based on their external IDs as well. That required a few small changes to the original script, and I'm including the enhanced script at the end of this post.
Here's an animation showing a search for items based on their external IDs.
Click the image to view a larger version.
A Summary of the Changes
Here's a quick summary of the changes that I made to the original script.
First, I added this subquery to the SuiteQL query, and its rows are appended to the recordset using the UNION operator.
SELECT '<a href="/app/common/item/item.nl?id=' || ID || '" target="_item" || ID || ">View</a>' || ' | ' || '<a href="/app/common/item/item?id=' || ID || '&e=T" target="_item" || ID || ">Edit</a>' AS Links, ExternalID, FullName AS Name, CreatedDate AS DateCreated, BUILTIN.DF( ItemType ) AS RecordType, ID AS InternalID, ItemID AS RecordID FROM Item WHERE ExternalID LIKE ?
Next, I adjusted the call to the runSuiteQL method, so that it includes a third "externalID" parameter.
var queryResults = query.runSuiteQL(
{
query: theQuery,
params: [ externalID, externalID, externalID ]
}
);
And that's all there was to it.
Wrapping Up
I want to thank the NetSuite community for the feedback that I received from my previous post, and for all of the nice feedback that I've been getting lately about my blog in general. I really do appreciate it.
