Other than wrapping chunks of JS code in a try-cat...
# suitescript
j
Other than wrapping chunks of JS code in a try-catch, are there ways to check permissions of the current user BEFORE doing something? I have a few instances where I want certain JS to run if possible but it’s not necessary if the user doesn’t have sufficient permissions (example: some JS to do with a custom record that they don’t have permissions on).
d
something like
nlapiGetContext().getRole()
? so you could do something like
Copy code
if (nlapiGetContext().getRole() !== '1041') { return false } else { //do stuff }
also for scripts, you can have permissions set so the script deployment only runs for certain roles