<@U019BCQD1HV> you could do a Role saved search
# suitescript
m
@William Hoyle you could do a Role saved search
w
I was hoping for something that could indicate that the calling user has read access to a specific record. This might vary by role, and the suitelet handles requests for a number of different record types.
m
Yup, you can use a saved search to get that information. You could also search by user and join to role, but then you will have to handle logic for users with multiple roles
Copy code
var role = runtime.getCurrentUser().role;

var searchObj = search.create({
    type: search.Type.ROLE,
    filters: [
        ["internalid", <http://search.Operator.IS|search.Operator.IS>, role],
        "AND",
        ["permission", search.Operator.ANYOF, "TRAN_CUSTINVC"]
    ],
    columns: [
        search.createColumn({ name: "level"}),
    ]
});
You would probably need to create a map between record type and permission names
In a quick test, admin role (internal id 3) doesn't come up in the search so make sure your code accounts for that
w
Thanks.