function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
theDtheD 

Javascript to find details on the Object of the current screen and related list

I have a home page component that can add notes/tasks to the current object in the detail page. I need find out through the Javascript what the current object is and if the sharing model allows the user to add notes/tasks and whether the object has notes/tasks (custom objs) . Right now this is all Javascript...no APEX and hoping to keep it that way if I can for the moment so if it is just a few calls in JS then good. Otherwise I am ok to do with JS/APEX if need be. 

 

Can anyone point me in the right direction? 

 

p.s. I see the 

SELECT RecordId
     FROM UserRecordAccess

 code but worried about a lot SOQL hits since this component  could get driven by screen refreshes. 

sandeep@Salesforcesandeep@Salesforce

You should ccess URL in JS and find id and profix which will let you know object type and then you can use Soforce.connection SOQL toget complete information.

theDtheD

S - yes already have the url and have done some checking for prefix  where necessary but I woul like to make it more generic...as I said,  I see the SOQL call....just wishing I didn't have to add the overhead. 

sfdcfoxsfdcfox
If you use Visualforce, you don't have to worry about the performance. No API calls, and easy to check the security levels using UserRecordAccess, as in your demo code. That is the most appropriate way to accomplish your goal. I could write up a demo if you need further details.
Ashish_SFDCAshish_SFDC

Hi, 

 

See the link, it has the Prefixes of Standard Objects which appear in the URL, this can help you query and catagotrize the object record page.

 

http://www.us-techpro.com/2012/06/key-prefixes-of-standard-objects-in.html

 

Regards,

Ashish