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
uHaveOptionsuHaveOptions 

Using ApexPages.currentPage().getParameters().get('id') with a custom visualforce page

I've been having some problems with replacing a Standard controller view with a Visualforce page following this: https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_quick_start_tabs.htm

The problem is, it's breaking a lot of my apex classes. For example, anything that uses:
 
ApexPages.currentPage().getParameters().get('id')

Which will throw this error:
Id value is not valid for the Property__c standard controller
Is there another way to get record ids using visualforce pages? We use these frequently

Here is one example of a code that is breaking:

   
public class ControllerCreateProposalView {
        public Id lId;
        public String convertedId;
    
        public ControllerCreateProposalView(ApexPages.StandardController stdController){
            lId = ApexPages.CurrentPage().getParameters().get('id');
            System.Debug('#######leadId:' + lId);
        }
    
    
        public PageReference convert(){
    
            
            Property__c l = [SELECT Id, name, Primary_Contact__c, Primary_Contact__r.id,Store_Number__c, Last_Sale_Date__c, Square_Footage__c, Last_Sale_Price__c, Anchor_GLA__c, CAP_Rate__c, Year_Built__c, Lot__c, Year_Renovated__c, Occupancy__c, Zoning__c, External_ID_APN__c, Number_of_Buildings__c, Number_of_Retail_Units__c, Loan_Balance__c, Maturity_Date__c, Interest_Rate__c, Term__c, Original_Lease_Term__c, Options__c, Term_Remaining_on_Lease__c, Gross_Leasable_Area__c, Type_of_Ownership__c, Parking__c, Parking_Ratio__c, Lease_Type__c, Date_Reported__c, Loan_Amount__c, Loan_Type_bcc__c, LTV__c, Lender__c, Lender_Type__c, Amortization__c, Recourse__c, Current_Interest_Rate__c, Payment__c, Prepayment__c, Proposal_date__c FROM Property__c WHERE Id=:lId LIMIT 1];
            Proposal__c c=new Proposal__c(Name=l.Name, Property__c=l.Id, Client__c=l.Primary_Contact__c, Square_Footage__c=l.Square_Footage__c, CAP_Rate__c=l.CAP_Rate__c, Lot__c=l.Lot__c, Loan_Balance__c=l.Loan_Balance__c, Maturity_Date__c=l.Maturity_Date__c, Term__c=l.Term__c, Original_Lease_Term__c=l.Original_Lease_Term__c, Options__c=l.Options__c, Term_Remaining_on_Lease__c=l.Term_Remaining_on_Lease__c, Anchor_GLA__c=l.Anchor_GLA__c, Occupancy__c=l.Occupancy__c, Number_of_Buildings__c=l.Number_of_Buildings__c, Number_of_Retail_Units__c=l.Number_of_Retail_Units__c, Gross_Leasable_Area__c=l.Gross_Leasable_Area__c, Type_of_Ownership__c=l.Type_of_Ownership__c, Parking__c=l.Parking__c,Parking_Ratio__c=l.Parking_Ratio__c, Year_Built__c=l.Year_Built__c, Lease_Type__c=l.Lease_Type__c, Date_Reported__c=l.Date_Reported__c, Loan_Amount__c=l.Loan_Amount__c, Loan_Type__c=l.Loan_Type_bcc__c, LTV__c=l.LTV__c, Lender__c=l.Lender__c, Interest_Rate__c=l.Interest_Rate__c, Lender_Type__c=l.Lender_Type__c, Amortization__c=l.Amortization__c, Recourse__c=l.Recourse__c, Current_Interest_Rate__c=l.Current_Interest_Rate__c, Payment__c=l.Payment__c, Prepayment__c=l.Prepayment__c);
            insert c;
           l.Sales_Status__c = 'Proposal';
           l.Proposal_Date__c=Date.today();
           update l;
            convertedId = c.Id;
            String cID=l.Primary_Contact__r.id;
            System.Debug('<>PROPOSAL<> :' + l );
            System.Debug('<>CEYEDEE<><>cID<><>CEYEDEE<> :' + cID );
     
            
                  //update contact stage
            List<Contact> contacts=[SELECT Id, Sales_Status__c FROM Contact WHERE id=:cID];
    System.Debug('<>LIST<><>contacts<><>LIST<> :' + contacts );
            if(contacts.size()>0){
            for(Contact i: contacts)
            {
    if(i.Sales_Status__c=='Unconfirmed'||i.Sales_Status__c==NULL){
            i.Sales_Status__c='Proposal';
            update i;
            }
            
    }
    }
            
            
            
            
    
            String sServerName = ApexPages.currentPage().getHeaders().get('Host');
            sServerName = 'https://'+sServerName+'/';
            System.Debug('#######sServerName :' + sServerName );
            String editName='/e?retURL=%2F'+convertedId;
            PageReference retPage = new PageReference(sServerName + convertedId+editName);
            System.Debug('#######retPage :' + retPage );
            retPage.setRedirect(true);
    
    
            return retPage;
        }
        public PageReference back(){
                String sServerName = ApexPages.currentPage().getHeaders().get('Host');
            sServerName = 'https://'+sServerName+'/';
            System.Debug('#######sServerName :' + sServerName );
            PageReference retPage = new PageReference(sServerName + lId);
            System.Debug('#######retPage :' + retPage );
            retPage.setRedirect(true);
            
            return retPage;
        }      
    }

Are there any alternatives to
ApexPages.currentPage().getParameters().get('id')
Mahesh DMahesh D
Hi Jon,

Please find the below code:
 
Property__c prop {get; set;}
public ControllerCreateProposalView(ApexPages.StandardController stdController){
	prop = (Property__c) stdController.getRecord();
	System.Debug('#######Prop Id:' + prop.Id);
}

This will work if your Standard Controller for the VF page is Property__c.

Please do let me know if it helps you.

Regards,
Mahesh
uHaveOptionsuHaveOptions
I tried this and I am still getting the same error :(
Mahesh DMahesh D
Hi Jon,

What is your Visualforce Page.

It should be:

 
<apex:page standardController="Property__c" extensions="ControllerCreateProposalView">
</apex:page>

Please paste your VF page also here.

Regards,
Mahesh
uHaveOptionsuHaveOptions

<apex:page standardController="Property__c" showHeader="true" sidebar="false" extensions="PropertyExtensionController, ControllerCreateProposalView">
<apex:includeScript value="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js" />

<script>
var j$ = jQuery.noConflict();
    j$(document).ready(function() {
        j$('.openInPopup a').click(function(event) {
            event.preventDefault();
            window.open(j$(this).attr('href'));
        });
    });    
    
</script>

    <!-- Define Tab panel .css styles -->
    <style>
    .activeTab {background-color: #081f3f; color:white; background-image:none;}
    .inactiveTab { background-color: lightgrey; color:black; background-image:none;}
    .name{font-size:20px;text-align:left;}
    .status{color:pink;}
    </style>

    <!-- Create Tab panel -->
    <apex:tabPanel switchType="client" selectedTab="Property__c" id="AccountTabPanel"
    tabClass="activeTab" inactiveTabClass="inactiveTab">
    <apex:tab label="Property Information" name="name1" id="Property" styleClass="openInPopup">
    <apex:form >

<script type='text/javascript'>
    function noenter(ev)  {
        if (window.event && window.event.keyCode == 13 || ev.which == 13) {
            SaveButton();
        if(key == 13) {
            $('output[savebutton#="SaveButton"]').click();
            return false;                     
         } else {
              return true;
         }
     }
</script>
<apex:actionFunction name="savebutton" action="{!save}" />

<apex:pageBlock >

<apex:pageblocksection >
 <apex:outputText style="font-size:20px;text-align:left;color:{!IF((Property__c.Sales_Status__c = 'Proposal'||Property__c.Sales_Status__c = 'Listing'||Property__c.Sales_Status__c = 'Escrow'||Property__c.Sales_Status__c = 'Sales Comp')&&(Property__c.Expired__c=false), 'red', IF((Property__c.Sales_Status__c = 'Proposal')&&(Property__c.Expired__c=true), 'blue', '#081f3f'))};" value="{0} | {1}">
 <apex:param value="{!Property__c.Name}"/>
 <apex:param value="{!Property__c.Sales_Status__c}" />    
</apex:outputText>
</apex:pageblocksection>

<apex:pageBlockButtons >
<apex:commandButton action="{!Save}" value="Save"/>
 <apex:outputLink styleClass="btn" style="text-decoration:none;padding:4px;" value="{!URLFOR($Action.Property__c.Create_Proposal)}">Create Proposal</apex:outputLink>

</apex:pageBlockButtons>
        
<apex:pageBlockSection columns="2">
<apex:inlineEditSupport event="ondblClick" showOnEdit="saveButton,cancelButton" hideOnEdit="editButton" />
<apex:pageBlockSectionItem >
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
 <apex:outputLabel value="Retail Type" for="Property__c.Retail_Type__c" />
 <apex:inputField value="{!Property__c.Retail_Type__c}" id="Property"/>     
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
 <apex:outputLabel value="Sale Status" for="Property__c.Sales_status__c" onkeypress="return noenter(event);" style="font-weight:bold"/>
 <apex:outputField value="{!Property__c.Sales_Status__c}" id="Property" styleclass="Property" />     
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
 <apex:outputLabel value="Retail Sub-Type" for="Property__c.Tenant_Sub_Type__c" />
 <apex:inputField value="{!Property__c.Tenant_Sub_Type__c}" id="Property"/>     
 </apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
 <apex:outputLabel value="Ownership Entity" for="Property__c.Ownership_Entity__c" onkeypress="return noenter(event);" style="font-weight:bold"/>
 <apex:outputField value="{!Property__c.Ownership_Entity__c}" id="Property"/>     
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >                
 <apex:outputLabel value="Primary Contact" for="Property__c.Primary_Contact__c" onkeypress="return onKeyup_TxtFieldcom(event);" style="font-weight:bold"/>
 <a href="/{!Property__c.Primary_Contact__c}" target="_blank">{!Property__c.Primary_Contact__r.name}</a>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
 <apex:outputLabel value="Primary Contact Company" for="Property__c.Primary_Contact_Company__c" onkeypress="return onKeyup_TxtFieldcom(event);" style="font-weight:bold"/>
 <apex:outputField value="{!Property__c.Primary_Contact_Company__c}" id="Property"/>
</apex:pageBlockSectionItem>       
<apex:pageBlockSectionItem >
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
 <apex:outputLabel value="Primary Contact Parent Company" for="Property__c.Primary_Contact_Parent_Company__c" onkeypress="return onKeyup_TxtFieldcom(event);" style="font-weight:bold"/>
 <apex:outputField value="{!Property__c.Primary_Contact_Parent_Company__c}" id="Property"/>
</apex:pageBlockSectionItem>         
<apex:pageBlockSectionItem >
 <apex:outputLabel value="Address" for="Property__c.Property_Address__c" onkeypress="return onKeyup_TxtFieldcom(event);" style="font-weight:bold"/>
 <apex:outputField value="{!Property__c.Property_Address__c}" id="Property"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
 <apex:outputLabel value="Primary Contact Phone" for="Property__c.Primary_Contact_Phone__c" onkeypress="return onKeyup_TxtFieldcom(event);" style="font-weight:bold"/>
 <apex:outputField value="{!Property__c.Primary_Contact_Phone__c}" id="Property"/>     
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
 <apex:outputLabel value="City" for="Property__c.City__c" onkeypress="return onKeyup_TxtFieldcom(event);" style="font-weight:bold"/>
 <apex:outputField value="{!Property__c.City__c}" id="Property"/>     
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
 <apex:outputLabel value="Primary Work Phone" for="Property__c.Primary_Work_Phone__c" onkeypress="return onKeyup_TxtFieldcom(event);" style="font-weight:bold"/>
 <apex:outputField value="{!Property__c.Primary_Work_Phone__c}" id="Property"/>     
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
 <apex:outputLabel value="State" for="Property__c.state__c" onkeypress="return onKeyup_TxtFieldcom(event);" style="font-weight:bold"/>
 <apex:outputField value="{!Property__c.State__c}" id="Property"/>     
</apex:pageBlockSectionItem>                
<apex:pageBlockSectionItem >
 <apex:outputLabel value="Primary Mobile" for="Property__c.Primary_Mobile__c" onkeypress="return onKeyup_TxtFieldcom(event);" style="font-weight:bold"/>
 <apex:outputField value="{!Property__c.Primary_Mobile__c}" id="Property"/>     
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
 <apex:outputLabel value="Zip Code" for="Property__c.Zip_Postal_Code__c" onkeypress="return onKeyup_TxtFieldcom(event);" style="font-weight:bold"/>
 <apex:outputField value="{!Property__c.Zip_Postal_Code__c}" id="Property"/>     
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
 <apex:outputLabel value="Primary Direct Number" for="Property__c.   Primary_Direct_Number__c" onkeypress="return onKeyup_TxtFieldcom(event);" style="font-weight:bold"/>
 <apex:outputField value="{!Property__c.Primary_Direct_Number__c}" id="Property"/>     
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
 <apex:outputLabel value="Primary Home Phone" for="Property__c.Primary_Home_Phone__c" onkeypress="return onKeyup_TxtFieldcom(event);" style="font-weight:bold"/>
 <apex:outputField value="{!Property__c.Primary_Home_Phone__c}" id="Property"/>     
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
 <apex:outputLabel value="Primary Contact Email" for="Property__c.Primary_Contact_Email__c" onkeypress="return onKeyup_TxtFieldcom(event);" style="font-weight:bold"/>
 <apex:outputField value="{!Property__c.Primary_Contact_Email__c}" id="Property"/>     
</apex:pageBlockSectionItem>                
<apex:pageBlockSectionItem >
</apex:pageBlockSectionItem>                
<apex:pageBlockSectionItem >
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
 <apex:outputLabel value="Last Call Date" for="Property__c.Last_Call_Date__c" onkeypress="return onKeyup_TxtFieldcom(event);" style="font-weight:bold"/>
 <apex:outputField value="{!Property__c.Last_Call_Date__c}" id="Property"/>     
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
 <apex:outputLabel value="Property Mailer Name" for="Property__c.Property_MAILER_Name__c" onkeypress="return onKeyup_TxtFieldcom(event);" style="font-weight:bold"/>
 <apex:outputField value="{!Property__c.Property_MAILER_Name__c}" id="Property"/>     
</apex:pageBlockSectionItem>     
<apex:pageBlockSectionItem >
 <apex:outputLabel value="Primary Contact Region" for="Property__c.Primary_Contact_Region__c" onkeypress="return onKeyup_TxtFieldcom(event);" style="font-weight:bold"/>
 <apex:outputField value="{!Property__c.Primary_Contact_Region__c}" id="Property"/>     
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
 <apex:outputLabel value="Type of Ownership" for="Property__c.Type_of_Ownership__c" onkeypress="return onKeyup_TxtFieldcom(event);" style="font-weight:bold"/>
 <apex:outputField value="{!Property__c.Type_of_Ownership__c}" id="Property"/>     
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
 <apex:outputLabel value="Description" for="Property__c.Description__c" onkeypress="return onKeyup_TxtFieldcom(event);" style="font-weight:bold"/>
 <apex:outputField value="{!Property__c.Description__c}" id="Property"/>     
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
 <apex:outputLabel value="Lease Keyword Search" for="Property__c.Lease_Keyword_Seach__c" onkeypress="return onKeyup_TxtFieldcom(event);" style="font-weight:bold"/>
 <apex:outputField value="{!Property__c.Lease_Keyword_Seach__c}" id="Property"/>     
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
 <apex:outputLabel value="Retail Type" for="Property__c.Type__c" />
 <apex:inputField value="{!Property__c.Type__c}" id="Property"/>     
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
 <apex:outputLabel value="Retail Sub-Type" for="Property__c.Sub_Type__c" />
 <apex:inputField value="{!Property__c.Sub_Type__c}" id="Property"/>     
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
</apex:pageBlockSectionItem>

</apex:pageBlocksection>           
</apex:pageBlock>

</apex:form>
</apex:tab>
   

</apex:tabPanel>
</apex:page>
uHaveOptionsuHaveOptions
It's too long, so I cut out some of the other tabs
Mahesh DMahesh D

Hi Jon,

How are you testing this page? 

It should be from Property__c details page. But not sure how you are testing it.

Also what is the value you are getting in the debug for below message:

System.Debug('#######Prop Id:' + prop.Id);

Regards,
Mahesh

uHaveOptionsuHaveOptions
Actually, it looks like the problem have nothing to do with my apex code. It has to do with a button on the Property__c object. This button is supposed to send the user to another page which runs the apex class. It's a detail page button, which is supposed to redirect to this URL:
/apex/CreateProposalView?id={!Property__c.Id}

Added a screenshot here: tiikoni.com/tis/view/?id=7dee2ed
Mahesh DMahesh D
Hi Jon,

Please try this option:

Here the Source is Visualforce Page and Content is yout actual page.


User-added image

Please do let me know if it helps you.

Regards,
Mahesh
uHaveOptionsuHaveOptions
Alright! That part is working now. So I am halfway there. It goes to the correct page to run the Apex class now. However, when I look at the debug log,
prop.id

is null
Mahesh DMahesh D
Hi Jon,

What about the other controller extension, can you do the samething in that controller also and see the debug.

Regards,
Mahesh
uHaveOptionsuHaveOptions
That one gave me the correct value for prop.id   . . . any idea why that might be?
Mahesh DMahesh D
Ok Got you. Now that issue is with second extension controller which is not getting the value.

I tested the code from below URL and it is displaying both controllers properly.


https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller_extension.htm
 
public class ExtOne {
    public ExtOne(ApexPages.StandardController acon) { 
        Account acc = (Account) acon.getRecord();
        
        System.debug('============Ext One:'+acc.Id);
    }

    public String getFoo() {
        return 'foo-One';
    }
}
 
public class ExtTwo {
    public ExtTwo(ApexPages.StandardController acon) {
        Account acc = (Account) acon.getRecord();
        
        System.debug('============Ext Two:'+acc.Id);
    }

    public String getFoo() {
        return 'foo-Two';
    }
}
 
<apex:page standardController="Account" 
    extensions="ExtOne,ExtTwo" showHeader="false">
    <apex:outputText value="{!foo}" />
</apex:page>

And tested it with below URL:

https://c.na2.visual.force.com/apex/AccountExtentionVF?Id=0014000000HJXxF

Regards,
Mahesh

 
uHaveOptionsuHaveOptions
I don't understand what I am supposed to learn from this. Is that not what I am already doing with
public Property__c prop {get; set;}
public ControllerCreateProposalView(ApexPages.StandardController stdController){
    prop = (Property__c)stdcontroller.getRecord();
    System.Debug('#######Prop Id:' + prop.id);
}

?

 

uHaveOptionsuHaveOptions
I took another look at my debug log. It looks like when the page is first loaded, an id is returned, but when the button is pressed, this id becomes null.
Mahesh DMahesh D
Hi Jon,

All the input fields needs to change from

<apex:inputField value="{!Property__c.Tenant_Sub_Type__c}" id="Property"/>

to

<apex:inputField value="{!prop.Tenant_Sub_Type__c}" id="Property"/>

This way we are able to capture and store the Property__c record information into a member variable.

prop is member variable of any of the extension controller.

Regards,
Mahesh
uHaveOptionsuHaveOptions
It was easier to just switch out prop.id for property.id instead, so I did that. Haven't notivced any change
uHaveOptionsuHaveOptions

I found a way to get around this problem. The visualforce page was just a "Are you sure you want to do this yes/no"? page, so I simply replaced this with a javascript pop up dialog box that does the same thing.

But, my underlying problem still remains. When I use a visualforce page instead of a standard page, {!sObject.id} no longer works on a custom button. Here's another example of this problem.

I have a "Log a Call" button, which used to work. Here's a screenshot of it:
http://www.tiikoni.com/tis/view/?id=01a901c
As you can see, the URL is /00T/e?who_id={!Contact.Id}&followup=1&tsk5=Call&retURL=%2F{!Contact.Id}

This button still works, but it does not return a "whoid" or an id for "retURL", these are both null. So after the user saves the task, when they save the task, they end up back on the home page.

I tried replacing it with this code:
 http://www.tiikoni.com/tis/view/?id=e2b7549

/00T/e?who_id={!Contact.Id}&followup=1&tsk5=Call&retURL=apex/ContactTabs?id={!Contact.Id}
This uses the URL for the new visualforcepage. But I when I use this version of the button, it gives me an error:
Id value is not valid for the Contact standard controller

The same thing happened to my other custom button on the Property__c object. When I used my custom visualforce page {!Property__c.id} returned null.

So, how can I fix the problem of {!sObject.id} always returning null?

 

Mahesh DMahesh D
Hi Jon,

Please provide me the printscreen of you button so that it will be easy to troubleshoot.

Regards,
Mahesh
uHaveOptionsuHaveOptions
http://www.tiikoni.com/tis/view/?id=e2b7549
Mahesh DMahesh D
Hi Jon,

You can use below URL:
 
/00T/e?tsk2={!Contact.Name}&tsk2_lkid={!Contact.Id}

Other parameters you can pass based on your requirement.

I already tested and it is working fine.

Regards,
Mahesh
uHaveOptionsuHaveOptions

Tried it and its the same behavior as before. It works, but after the user saves it, they are redirected to the home page. And the contact id is blank in the URL.

http://www.tiikoni.com/tis/view/?id=9692314

sd asssd ass
I have test this scirpt for my new real estate and property management (https://www.northpacificpropertymanagement.com/) project that hosted on WordPress. Can you help me regarding theme selection.