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

Erick @smith288

About: I’m a self taught hack. I’ve been known to use a goto statement. I don’t take myself too seriously and I don’t expect you to take me too seriously. If I’m wrong or suck, I have thick skin.

Location:
United States
Joined:
Sep 21, 2018

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

Publish Date: Oct 18 '23
0 1

"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.

Comments 1 total

    Add comment