We know how much important role visualforce plays in our application. There are many instance where we need to create a visualforce page and apex class. Salesforce provides powerful tools like workflows, approvals, validation etc. from which we can implement our business functionalities with just button clicks.
Now I was having a requirement where I need to create many visualforce pages, some are custom and some are cloning native page with native layouts with some small changes. This just clicked me to create a tool from which we can create a visualforce page code with just clicking buttons. Yes!! Visualforce page code with button click.
This saved a lot of time, as I do not need to write any thing to create a heavy visualforce page and amazingly it is done just using button clicks.
Install the package : https://login.salesforce.com/packaging/installPackage.apexp?p0=04t90000000Pqos
Just append "/apex/vfgenerator__codegenerator" in URL.
Now let me jump into the explanation what exactly I have done. A simple UI will be displayed, where user can select the desired type of page, object name, record type, email field.
Object Name : Valid object API name (include namespace if any)
Record Type : Record type Id of object selected in Object Name
Type of Page :
Now I was having a requirement where I need to create many visualforce pages, some are custom and some are cloning native page with native layouts with some small changes. This just clicked me to create a tool from which we can create a visualforce page code with just clicking buttons. Yes!! Visualforce page code with button click.
This saved a lot of time, as I do not need to write any thing to create a heavy visualforce page and amazingly it is done just using button clicks.
Install the package : https://login.salesforce.com/packaging/installPackage.apexp?p0=04t90000000Pqos
Just append "/apex/vfgenerator__codegenerator" in URL.
Now let me jump into the explanation what exactly I have done. A simple UI will be displayed, where user can select the desired type of page, object name, record type, email field.
Object Name : Valid object API name (include namespace if any)
Record Type : Record type Id of object selected in Object Name
Type of Page :
- Edit : Code will be generated for the edit page of the object (according to "record type" layout if selected any).
- Detail : Code will be generated for the detail page of the object (according to "record type" layout if selected any)
- Custom Detail : Code will be generated for detail page according to the fields selected from UI
- Custom Edit : Code will be generated for edit page according to the fields selected from UI
In the above screen I have selected "Edit" as the type of page and "Account" in object, also provided my email. When I click "Generate Code" it displays like this :
Just copy the code and paste it in new visualforce page. Why I have given my email id because when you paste the code in visualforce page it will loose all the formatting and will display in one single line, but code sent on email will come with formatting. So we can copy the generated code from email also. Now when you hit the newly created visualforce page it will display all fields in edit mode which are displayed on native edit page. Isn't that good?
Now lets try creating some custom visualforce page. Select "Custom Edit" in "Type of Page" and "Account" in "Object Name". It will display a section "Select Fields". Click on "Display Fields", it will display all fields which are up datable by present user.
Select some fields and click on "Generate Code". Again copy paste the code in your visualforce page, it will display selected fields in edit mode.
Now heavy visualforce pages are created with just button clicks.
Package provided is managed because the tool is under testing and I would like to have feedback from you. Once it is free from all bugs I will provide the code.
Declaration: You may find similar post related to "Visualforce Code Generator". The end result may be similar but there is a considerable difference in the approaches being followed here. So I, hereby declare that my project is entirely my own creation and has not been copied from any other person/organization's words or idea. Please feel free to drop me an email at "arora.salesforce@gmail.com" if there is any disagreement.
Declaration: You may find similar post related to "Visualforce Code Generator". The end result may be similar but there is a considerable difference in the approaches being followed here. So I, hereby declare that my project is entirely my own creation and has not been copied from any other person/organization's words or idea. Please feel free to drop me an email at "arora.salesforce@gmail.com" if there is any disagreement.
Cheers
This looks fantastic Ankit! Hope to use it soon, will let you know how i get on with it.
ReplyDeleteMitz.Chauhan@gmail.com
Just install the package on your organization :
ReplyDeletehttps://login.salesforce.com/packaging/installPackage.apexp?p0=04t90000000Pqos
And use http://......../apex/vfgenerator__codegenerator in URL.
Let me know if you face any problem.
Really its Amazing and saves lot of time.
DeleteGreat..................Ankit
Deletehello ankit i installed and appended but package not found error i am getting
Deletehi ankit i didnt find that code genrator option in my account plz tell me the step..i install package ..
DeleteGreat job dude....keep up the great work....really cool
ReplyDeleteThank you so much !!!
ReplyDeleteAmazed by the thought u have put in to create this tool....It will definitely help a lot of guys....If you are planning to extend it to custom controllers and need help....u can ping me and i can help you out if its a lot of burden on you. Anyways good luck....
ReplyDeleteThank you so much, this is appreciable !! Just waiting for the feedbacks/suggestions from all. After implementing all I will distribute the code too, so a particular can do changes accordingly.
ReplyDeleteIf you have any ideas related to this do mail me or add me, would love to have a chat with you over this.
arora.salesforce@gmail.com
This is extremely good thought.. Hope salesforce listens and implements some thing big based out of this.
ReplyDeleteI am also thinking to create some plugin on top of Force.com Eclipse IDE. But doing directly using Apex is great.
Can you share the code for us or make it open source project in Google Code so everyone can contribute?
My idea is to create a plugin in Eclipse where users can drag and drop fields and components to create Visual Force page. Just like JSF, GWT or any other editors out there in market.
Great Ankit.
Thank you so much !! I am also looking forward if salesforce can implement this kind of thing where we can create visualforce pages and apex classes with just button clicks or drag and drop.
ReplyDeleteAnd I will provide the the code as open source once I will have a satisfactory feedback. I just want to make sure that this tool must be error/bug free.
ReplyDeleteHave you thought about putting the generated Visualforce code in a <textarea> HTML Tag, this will look formatted and should not need the email :-)
ReplyDeleteGreat !! But 32K character limit won't be a problem???
ReplyDeleteExcellent approach! Here I would like to suggest that when I select custom Edit mode then all required fields should be highlighted for easy to use.(Because without selecting required field I would be unable to save record and I have to come back for generating code again by including required fields)
ReplyDeleteIndeed a good suggestion !! Thanks Sandeep, I will surely consider this.
ReplyDeletehey how easy is it to create the plugin to drag and drop components in eclipse....could we achieve....if yes, can someone provide the necessary starting steps....
ReplyDeleteVery cool! I wonder if it would be possible to use the metadata API to (1) find the record type id from the object name and (2) push the VF page into your org? It would be great if you could automate it so that the 'Generate Code' page did all that and just took you straight to the VF page :-)
ReplyDeleteThank you for the awesome suggestions!! I am already working to push the VF page, but fetching record type was no where in my mind.
ReplyDeleteThanks again.
One More thing I would like to share that It would be more easy to use this tool if you provide a dependent picklist(depends on obj) in place of text field for recordtype Id (because it is very lengthy process to fetch recordtype Id by query or by any other way)
ReplyDeleteLooks Very Good Ankit.
ReplyDeleteyou Did Good job.
Thanks HariDinesh !
ReplyDeleteReally cool Ankit !! Great job !!
ReplyDeleteThanks KG!
ReplyDeleteReally great Ankit, good work. This opens up all kinds of possibilities for speeding up Dev work.
ReplyDeleteI can see this becoming the future of development for creating totally customized
Do you have plans to extend this to creating custom components, such as the "homepage Dashboard" component?
Thanks for the good words Sumsum!! Am working on some extensions with this, coming soon !!!
ReplyDeleteThank you Javier!!
ReplyDeleteGreat work Ankit. Appreciate this !!
ReplyDeletethat's awesome dude. I was looking out for apex classes written for a particular standard object. If I need to write the class for "view all accounts page"; where would I get that from. Does your package include apex code for classes too?
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThis is freakin' awesome!!!! You have saved us all SOOOO much time and effort.
ReplyDeleteOne issue I found. I was getting "Error: Invalid field name for SObject QuoteLineItem" when trying to save the code until I removed subtitle="{!QuoteLineItem.name}" from the
Great work. Keep it up
it cut off the rest of my sentence. I removed subtitle="{!QuoteLineItem.name}" from the apex:sectionHeader and it fixed the issue.
DeleteHi i need to search/create accounts and contacts from linkedin into salesforce..... and display it in Visual Force. Any Idea of how to implement this
ReplyDeleteCUST BILLING
ReplyDeletei have created a search visual force page,all records are displayed there.so I want to send email to those records which are present .Because we cant use workflows here
ReplyDeleteCool, it saved a lot time for me. Thanks Ankit.
ReplyDeleteAaaaaaaawww maaaaan! This doesn't work with Custom Objects, only Standard Objects.
ReplyDeleteFantastic!!! Just what I was looking for. It DOES do custom object, but it's a bit quirky. First choose the Type of Page you want, THEN type the API object name, (mine was Scope__c) then click in the record type box so it refreshes.
ReplyDeleteThen click Generate Code.
One weird thing I had was that I could only install it in my developer org, not my config sandbox. But that's not a huge deal.
Thank you so very much for this.
Sir ,This is One sound Good .Thanks .But I want to to generate Vf code for Console.How ???
ReplyDeleteIts really good job
ReplyDeleteThank you so very much
Thank you so very much for this article
bro its working i am impressed .....................
ReplyDeletethank you so much for sharing this app.
This worked perfectly and was exactly what I needed...especially for one who's very new to Visualforce. Thank you so much!!
ReplyDeleteTry this out : http://forceguru.blogspot.in/2015/03/visualforce-code-generator-coding-via.html
DeleteMight help more :-)
Very good tool for beginners...Great Job..Keep continue your good work. Thanks.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteSuper Ankit really awesome...Loved the way you did.. Only word the best .. :)
ReplyDeleteFantastic One!! How to install it in my Sandbox? i couldn't able to install. For Dev org i am able to install.
ReplyDeletePlease suggest!!
Hi Ankit,
ReplyDeleteGreat Job!
Though I am seeing this post only now, its a fantastic tool.
Thanks
Sunil
Really Superb...
ReplyDeleteThanks
Manoj
Really good one.... Loved it.... Yet to explore more on the same....
ReplyDeleteYou are really amazing ...no words ...I'm keeping my fingers crossed for you...
ReplyDeleteHi Ankit,
ReplyDeleteTremendous job, I know you are very busy but If possible please help me out.
I have successfully extract the page layout detail into JOSN. I did save it into a custom object rich text area field. I looked that JSON.deserialize does not parse this string value even I created proper wrapper classes against this.
Yes I looked that the whole data having some lists as well like layoutRows and layoutComponents which must be treat as rectangle bracket "[]". But there is no such notation. This might be the reason JSON.deserialize not working.
I just wanted to know that how did you parse it to generate all nodes inside VF page ?
Thanks
Vijay
oh! got it you parsed on VF page itself using script, I was looking it through JSON class to make it easy.
DeleteHi Ankit,
ReplyDeleteFound this tool and thought it was great.
I just installed the package. But it does not generate the code and no email. I tried Object Name = account, type of page = Edit; generate code section was empty after generate code button is clicked. When I selected custom object I could select my fields, still no code was generated.
Do you have new version?
Thanks,
wyw
Try this out : http://forceguru.blogspot.in/2015/03/visualforce-code-generator-coding-via.html
DeleteHi Ankit,
ReplyDeleteI want code for Send email (in task Activity) custom functionality for custom object in visualforce page.
Normal send email button in Activity history "To" field having contact and lead objects but i want custom object.
Can you please tell me some idea.
Thanks in advance
I have searched your extension on the app exchange and i could not find it ? Could you explain me why ? thanks
ReplyDeleteTry this out : http://forceguru.blogspot.in/2015/03/visualforce-code-generator-coding-via.html
DeleteAll, here is the updated version of this app. Please provide your feedback : http://forceguru.blogspot.in/2015/03/visualforce-code-generator-coding-via.html
ReplyDeleteHello Ankit,
ReplyDeleteI've installed the app from the app store.
I've appended the vfgenerator thing in the URL and nothing shows up.
Could you be specific on it.
thank you
Hello Ankit,
ReplyDeleteThanks for sharing your knowledge.
I have try to create dynamic apex page generate.So I have use Tooling API calling.but it give me erorr "Unexpected character ('A' (code 76)): was expecting comma to separate OBJECT"
I have set Markup Field following this.
private HttpRequest createHttpRequest(String endpoint, String method)
{
HttpRequest req = new HttpRequest();
endpoint += '';
req.setHeader('Authorization', 'Bearer ' + UserInfo.getSessionID());
req.setHeader('Content-Type', 'application/json');
req.setCompressed(true);
ApexPage ap=new ApexPage();
ap.ApiVersion=40.00;
ap.ControllerKey='Account';
ap.ControllerType='1';
ap.Markup='';
ap.MasterLabel='ApexSample5';
ap.Name='ApexSample5';
string JApexPage=JSON.serializePretty(ap);
req.setBody(JApexPage);
req.setEndpoint(endpoint);
req.setMethod(method);
return req;
}
If I am write without standardController is working but when I am use standardController="Account" is not working.
Can you please help me?
My Email is "heavendev0005@gmail.com"
It's great tutorial. thank you for sharing.
ReplyDeleteRegards,
Web Scraping Service