I create a custom visualforce page where user inserts one value (i.e. Indirizzo__c). Now I want to add a button on the vf that create an Event (Salesforce standard Object) and fills one field, inside the Event, with the value inserted by the user. Now I'm using this code:

apex:commandButton value="new Event" onclick="window.location='/00U/e?Indirizzo__c={!$CurrentPage.parameters.Event.Indirizzo__c}&nooverride=1'; return false;"

but it doesn't work, because Indirizzo__c is null instead have the value inserted by the user. How can i do that?

  • you want to create a button on vf page or a custom salesforce button? – Anurag Jun 16 '16 at 13:36
  • a button on the vf page – L.benedettini Jun 16 '16 at 13:37
  • you can write a method to create an event and insert the value in a field that user entered. You can add the method on action attribute if commandbutton. – Anurag Jun 16 '16 at 13:45
  • I'm assuming lightning isn't available? Even if it isn't this might help you out some developer.salesforce.com/trailhead/force_com_dev_intermediate/… – Griffin Jun 16 '16 at 13:49
  • I explain it badly I'm sorry, but I want that click the commandbutton open the standard Event page creation with a field filled with the value inserted before – L.benedettini Jun 16 '16 at 13:49

You have to pass the proper fieldname to get the value populated. To get the field names, use web developer console of chrome. Append it as key value parameter in the URL as shown in the below screenshot.

In VF page the URL will look like something /00U/e?evt13=" & {!Start_Time__c} "&evt4=" & {!Date_Proposed__c}.....

(The above URL is only an example and not tested.)

enter image description here

  • Thank you with the tips from Saroj I solve the problem. Thank you thank you thank you – L.benedettini Jun 16 '16 at 14:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.