https://netsuiteprofessionals.com logo
#general
Title
# general
i

Isis Herrero

04/27/2022, 7:22 AM
Hi: I’m trying to show a custom Fulfill button on a SO only when the user has the ‘Fulfill Orders’ permission with a level higher than ‘Create’. The role I’m using to test this does not have that permission at all, and yet the getPermission function returns that permission with a FULL level. I have other roles that have that permission with FULL level, but that shouldn’t affect it, right? Any ideas why this may be happening?
b

battk

04/27/2022, 7:26 AM
what does your code look like
i

Isis Herrero

04/27/2022, 7:31 AM
Copy code
const userObj = runtime.getCurrentUser();
const RoleAccess = userObj.getPermission('TRAN_SALESORDFULFILL');
if (RoleAccess === runtime.Permission.FULL || RoleAccess === runtime.Permission.CREATE || RoleAccess === runtime.Permission.EDIT) {
  scriptContext.form.addButton({
    id: 'custpage_fulfill',
    label: 'Fulfill',
    functionName: `customItemFulfillment(${RecordId});`,
  });
}
If I log the RoleAccess, it returns 4 (FULL level)
b

battk

04/27/2022, 7:33 AM
that looks like the correct id for the permission
what is the execute as role on the script deployment?
i

Isis Herrero

04/27/2022, 7:35 AM
It’s executing it as Admin. That may be it!