Hi: I’m trying to show a custom Fulfill button on ...
# general
i
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
what does your code look like
i
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
that looks like the correct id for the permission
what is the execute as role on the script deployment?
i
It’s executing it as Admin. That may be it!