DEV Community

Cover image for How do I check if a bundle is installed in Netsuite?
Erick
Erick

Posted on

How do I check if a bundle is installed in Netsuite?

"I want to see if the customer has Ship Central installed prior to doing my cool feature. How do I do that?"

In a word, simple. You search for a custom record type of a record that would exist in the bundle you want to check for.

In my example, I would like to see if the customer has the Netsuite Ship Central bundle installed. All you have to do is use the little known search type called 'customrecordtype' against the column 'scriptid'.

Check out this function:


function doesRecordExist(scriptId) {
    var customRecordTypeSearch = search.create({
        type: "customrecordtype",
        filters: [["scriptid", "is", scriptId]],
        columns: ["scriptid"]
    });

    var searchResult = customRecordTypeSearch.run().getRange({
        start: 0,
        end: 1
    });
    custom_exists = searchResult.length > 0;
    return custom_exists;
}

Enter fullscreen mode Exit fullscreen mode

And you can run it like this:

if(doesRecordExist('customrecord_packship_shipmanifest')){
    // DO SOMETHING COOL
}
Enter fullscreen mode Exit fullscreen mode

Give it a whirl. It's a great method to verify something exists prior to enabling a feature in your own bundle.

Top comments (0)