So, NetSuite wants us to include a Least Privilege...
# ask-stanley-ai
d
So, NetSuite wants us to include a Least Privilege Access role in our SuiteApps. We want our SuiteApps to support both OneWorld and NonOneWorld accounts. We do that with code-level feature checks. But, if the role that executes doesn't have Subsidiary List view, we fail in a OneWorld environment because we don't have the permission to search Subsidiaries ... and if we ADD that permission to the custom role, it because a required feature in the manifest.xml .. and will no longer install into NonOneWorld accounts. How can I define permissions based on whether a feature is enabled or not?
c
AI generated answer (using internal Slack threads):
Based on the conversations, it seems that you can use the
runtime.isFeatureInEffect({ feature: 'SUBSIDIARIES' })
function to check if the 'SUBSIDIARIES' feature is enabled or not. This function returns a boolean value indicating whether the specified feature is enabled in the current account. If the feature is enabled, it means that the account is a OneWorld account. If not, it's a NonOneWorld account. However, it's important to note that this method is not officially documented by NetSuite, so use it with caution. Also, keep in mind that some accounts may be provisioned as "one world" but limited to one subsidiary. So, depending on your end goal, you might need to count the actual number of subsidiaries instead of just checking the feature. Here's a sample code snippet:
Copy code
javascript
var isOneWorld = runtime.isFeatureInEffect({
    feature: 'SUBSIDIARIES'
});
In this code,
isOneWorld
will be
true
if the account is a OneWorld account, and
false
if it's a NonOneWorld account. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.867919922
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.864318907
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.864135742
Please provide your feedback on this answer.
Thank you for your feedback
Thank you for your feedback