One of my standard layout button executes JavaScript as: (Only relevant lines posted)
var query = "Select id,Name from User where name ='Integration User' Limit 1";
var records = sforce.connection.query(query);
var records1 = records.getArray('records');
acc.OwnerId= records1[0].Id;
This code fails for a user belonging to some custom profile. It gives error saying "can not specify id of undefined".
But it works fine for System administrator. Clearly problem is about querying User object and access on user records.
What permission should i consider for custom profile user to give him ability to execute this SOQL.
I would not like to hard code Integration user id in JavaScript code.
without sharing
code if you can live with usingApex
instead.