This client script works for Administrator, but fa...
# suitescript
e
This client script works for Administrator, but fails to another role in the line for getSubrecord. The error is
NOT_A_SUBRECORD_FIELD
. Any clue?
Copy code
var subsidiary = currentRecord.getValue({fieldId:'subsidiary'});
var resultSub = record.load({
    type: search.Type.SUBSIDIARY,
    id: subsidiary
});

var mainaddressOBJ = resultSub.getSubrecord({ fieldId: 'mainaddress' });
b
the usual is to get the the url of the record in a role that has access
then open that url with a record that doesnt have access
a lot of the time the role change page will give you the missing permission
if that doesnt work, its the permission guessing game
e
Thanks @battk Just found it, it needs Subsidiaries Edit permission, not only View. Weird. I guess I need to convert to User Event to run the script as Admin, instead of giving some users that permission.
b
you may also be able to do a search or query instead
e
You are right @battk Thanks