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

This site is built on Heroku

Join the ranks of developers at Salesforce, Airbase, DEV, and more who deploy their mission critical applications on Heroku. Sign up today and launch your first app!

Get Started

Top comments (0)

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

👋 Kindness is contagious

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

Okay