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
Baktash H.Baktash H. 

How to get the record id from the URL without standard controller

Hello,

I'm about to build a page which should be put in the standard layout of record pages.

The page should work for every object thats why i can't use the standard controller, because in the standard controller I need to know on which object I am. Then i need to get the record ID of the record from the URL.

 

One way would be to get the URL of the page and get the ID with String methods. But I don't think thats very professional and may lead to errors some times.

 

Maybe you have any Ideas.

JitendraJitendra

Hi,

For this you can use Javascript or JQuery to get the URL of current page using syntax something like "document.URL". Then using Regular Expression or some other logic you can extract the ID from page.

 

 

Baktash H.Baktash H.

But then I get the ID when the page is already loaded. But I need the ID in the constructor.