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
Admin User 10568Admin User 10568 

Parse Object Id to Visual Force Page / Class When Embeded in Public Site

Hello, 

Wondering if anyone knows how to parse an object Id to a Visual Force page when its embeded in a Salesforce Site and is public. 

My use case is a URL is created on the Object that our sales people can share with anyone outside the organisation. I've created the page and class and added it to a site and made it public. Only it wont parse the Id from the site to the page. 

Any help would be awesome. 

VinayVinay (Salesforce Developers) 
Hi Admin,

You can parse object id to vf page something like below.
<iframe src="/apex/MyPage?id=001rxcsowr1ewer" width="100%" height="600px"></iframe>
You can retrieve the object ID from the URL parameters using ApexPages.currentPage().getParameters().
public class MyPageController {
    public String objectId { get; set; }
    
    public MyPageController() {
        objectId = ApexPages.currentPage().getParameters().get('id');
    }
}

Please mark as Best Answer if above information was helpful.

Thanks,