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
shobana shobanashobana shobana 

how to dislay a new task button in visualforce

Hi every one 
I am new bie to Salesforce.
My scenario is to display the New task button in visualforce.when am clicking the button in visualforce i want to create a task for particular object.
can anyone give me tips to display  task button in visualforce.
I have tried to do that by using url of task button but its not working.


Thank  you in advance.
 
KaranrajKaranraj
Do you want to display the Standard Task creation window or you want to display custom task creation page?
If you want to display standard task creation page, create a button in the visualforce page using <apex:commandbutton> once user clicks the button redirect to the following URL
/00T/e?what_id=<id of record>&retURL=<id of record>
Alertnate Method: If want to display as relatedlist in your visualforce page, then you can do with the following code
<apex:relatedList list="CombinedAttachments"  subject="{!$CurrentPage.parameters.id}" />
Check this link to get start with Visualforce page - https://developer.salesforce.com/trailhead/force_com_programmatic_beginner/visualforce_fundamentals/visualforce_intro
 
shobana shobanashobana shobana
Thank you for your replay.
Actually i want to display standard Task Creation window  for lead object in visualforce.
For that command button is not working.
 
KaranrajKaranraj
Add the below code in your visualforce page, it will open the new task creation page in a window
<apex:commandButton title="New Task" value="New Task" onclick="window.open('/00T/e?','_blank','width=600,height=600,location=no,resizable=yes,toolbar=no,status=no,menubar=no,scrollbars=1', 1)"/>