Slackbot
01/26/2025, 8:12 AMCeligo AI
01/26/2025, 8:12 AMAI generated answer (using internal Slack threads):To restrict a user from seeing a customer if their location is different from the customer's location, you can use a combination of SuiteScript and workflows. Firstly, you need to create a custom field on the customer record for the location. This can be done by going to
Customization > Lists, Records, & Fields > Entity Fields > New
. Set the label as 'Location', ID as 'custentity_location', type as 'List/Record', and list/record as 'Location'.
Next, you need to create a workflow that will check the user's location against the customer's location. This can be done by going to Customization > Workflow > Workflows > New
. Set the record type as 'Customer', trigger type as 'Before Record Load', and state as 'Before Load'.
In the workflow, add a condition that checks if the user's location is not equal to the customer's location. If the condition is true, then the workflow should prevent the user from viewing the customer record.
Here is a sample workflow action script:
javascript
if (nlapiGetFieldValue('custentity_location') != nlapiGetUser().getLocation()) {
throw nlapiCreateError('INVALID_ACCESS', 'You do not have access to view this customer record.', true);
}
Please note that this script uses SuiteScript 1.0 API. If you are using SuiteScript 2.0, you will need to adjust the script accordingly.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
01/26/2025, 8:13 AMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.832191527
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.825122237
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.824864328
Celigo AI
01/26/2025, 8:13 AM