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
thorntonthornton 

VisualForce Login Abstraction Model

I have a easy question re abstraction of logic.

 

I have a VisualForcePage that needs to read an ID from the URL, lookup that data and autoredirect to the URL found in a custom Object returned by a query.

 

I understand that the redirect will be in javascript using the window.Location="someurl";

 

How do I read the URl coming from the page if defined and do the lookup?

Arun MKArun MK

 

Hi,

 

String recordId =ApexPages.currentPage().getParameters().get('id');

 

Your_Object__c obj = [Select Id, URL__c FROM Your_Object__c WHERE Id=: recordId];

 

PageReference pageRef = new PageReference(obj.URL__c);

return pageRef; // this will redirect the user to the URL found in the custom Object 

 

Regards,

Arun.

sandeep@Salesforcesandeep@Salesforce

You can read any property X from URL as below 

String y  = apexpages.currentpage().getparameters().get('X') ;

now if you want to read id from URL put id in place of X