+ Start a Discussion

inserting a visualsource page in to custom object


This is veeraiah.i have one question


in my application i have some visual force pages ,i have a custom object and also i have main controller .now my questio is i want to insert th visualforce pages which i create or i have ino the custom object  as a link from the controller.i should insert that page through the main controller and if we click the page inserted in the custom object then  need to see the no of queries(queries count ) in the object .


pls anybody help me on this





Best Answer chosen by Admin (Salesforce Developers) 

Hi Veeru,


Please create a field of type url and number on your custom object

and when you save the record then enter the url for your visual force page as


customobject__c cobj = new customobject__c();

cobj.urlfield__c =URL.getSalesforceBaseUrl().toExternalForm() + '/apex/vfpagename' ;


write a method to update the count on custom object


private void updateCount(){

if(customobj.numberField__c == null){

customobj.numberField__c = 1;


customobj.numberField__c += 1;




and call this method in constructor.


hope this will help you. Please mark this as solution if it work for you.