is there a way to get the current user id in conso...
# suitecommerce
p
is there a way to get the current user id in console?
e
Browser console?
p
yes.
i tried adding a console.log in the script but that gave an error on page load. also tried doing require('N/runtime') in console but that did not work.
e
Tested on the browser console, it works
require(['N/runtime']);
let runtime = require('N/runtime');
var userObj = runtime.getCurrentUser();
userId = userObj.id
s
If you’re working on the frontend then you can just pull it from the UserProfile component or Profile.Model
container.getComponent('UserProfile').getUserProfile().then(function(profile) {console.log(profile.internalid)})
p
I am trying to see why a search isnt bringing up the correct records for the current user. I did try @Edgar Valdes way but get a Module "N/runtime" not found