Is it possible to show the actual role used by the...
# suitescript
l
Is it possible to show the actual role used by the user who triggered the suitelet in the system notes? Use case: When a user clicks the Reject button on a journal entry, the user is routed to the Rejection Reason custom record. Once saved, a suitelet is triggered to copy the rejection notes from the custom record to the journal entry. When we look at the system information of the journal, it doesn't show the actual user and/or role used.
a
dont have the documentation in front of me but its available as part of the
n/runtime
module I believe something like
runtime.user.role
but there may be an api call to get to it not just a simple reference like above, sorry i don't remember
l
No worries. Thanks for the insights though
a
Copy code
// Add additional code
...
var userObj = runtime.getCurrentUser();
log.debug('Internal ID of current user role: ' + userObj.role);
...
// Add additional code
from https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_4296669948.html
oh sorry... in the system notes.. no but you can log it in your suitescripts at least - i guess you could create a custom record for a permanent log and add code in your script to create such a custom log record with whatever details you wanted
l
Yeah, that's what we do now. Store it in custom fields. Would like to stop doing that and store it in the native system info if possible
a
i mean i guess you could create a custom field and set the role to the current users role whenever its modified?
that would potentially be logged withthe same time stamp as all other changes
but it would need to custom field of each possible type and all all record types...and every custom record would need its own custom field added ... its ... not great