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.

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay