hello....we have a need to prevent employees from ...
# ask-stanley-ai
v
hello....we have a need to prevent employees from editing Customer Info, even for employees with edit access to Customer records. We are able to acheive this using Client/UE scripts. But certain roles have access to "Login as Customer" link on the Customer record and they are still able to alter the Customer Info...is there a way to prevent ?
c
AI generated answer (using internal Slack threads):
Based on the conversations, it seems that the best way to prevent employees from editing Customer Info, even for employees with edit access to Customer records, is to use a combination of role permissions and scripting. For the "Login as Customer" issue, it's a bit more complex. The "Login as Customer" feature is a powerful tool that allows certain roles to impersonate a customer and perform actions on their behalf. This feature is typically used for troubleshooting and customer support purposes. However, it can also be misused to alter customer information. Unfortunately, there is no out-of-the-box way to restrict this feature in NetSuite. You might need to create a custom script that checks if the current user is using the "Login as Customer" feature and then restricts them from editing the customer information. This script would need to be deployed on the customer record as a User Event or Client script. Here is a conceptual example of how this might work:
Copy code
javascript
function beforeSubmit(context) {
    if (context.type !== context.UserEventType.CREATE && context.type !== context.UserEventType.EDIT) {
        return;
    }

    var currentUser = runtime.getCurrentUser();
    if (currentUser.role === 'CUSTOMER') {
        throw new Error('You are not allowed to edit customer information while logged in as a customer.');
    }
}
Please note that this is a conceptual example and may not work as-is. You would need to adjust it to fit your specific needs and thoroughly test it to ensure it works as expected. ****** 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.850079298
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.839550257
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.834563613
Please provide your feedback on this answer.