• Andrew4
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies
Hi all,

I've been stuck on this for a while, so I'm finally asking for help - issue is similar to this one:
https://developer.salesforce.com/forums?id=906F000000094yFIAQ

I have a Visualforce page that uses the standard Event controller.  I overrode the "New Event" button to direct to this Visualforce page.  I'm having trouble pre-populating certain fields on that page.

For example, {!Event.whoID} is passed in the button URL and pre-populates the appropriate field by default.  I want to pass the User ID too and populate the Assigned To field, but I can't get it to work.  The default New Event page (which uses the same standard Event controller) populates the Assigned To field automatically, and without any additions in the URL... what am I missing?  Does my VF page need a controller extension?  If so, can anyone give pointers on what that needs to look like?

I assume I need to A) include whatever IDs I want populated in a custom button URL, and simultaneously B) build a controller extension that tells my VF page to pull the values out of the URL and load them in my input fields.  But all my attempts to implement this setup so far have failed.

Any pointers will be greatly, greatly appreciated.  Thanks for your help!



VF page snippet:
<apex:page standardController="Event" showHeader="true" sidebar="true">
    <apex:sectionHeader title="Log A Call"/>
    <apex:form id="pageForm">
        <apex:pageBlock title="Call Edit" mode="edit">
            <apex:pageBlockButtons location="both">
                <apex:commandButton value="Save" action="{!save}" id="saveButton"/>
                <apex:commandButton value="Cancel" action="{!cancel}" />
            </apex:pageBlockButtons>
            <br />
            <apex:pageBlockSection title="Owner" columns="2" collapsible="false">
                <apex:inputField value="{!Event.ownerID}" label="Who took the call?" style="width:200px;height:15px;" />
                <apex:inputField value="{!Event.StartDateTime}" label="Start" />
                <apex:inputField value="{!Event.Subject}" label="Subject" />
                <apex:inputField value="{!Event.EndDateTime}" label="End" />
                <apex:inputField label="Person" value="{!Event.whoID}" style="width:300px;height:20px;" />
                </apex:pageBlockSection>
                </apex:pageBlock>
    </apex:form>
</apex:page>

Current button URL (owner ID to be added):
https://c.cs8.visual.force.com/apex/NewLogCall?who_id=XXXX&retURL=%XXXX&sfdc.override=1


Assuming a controller extension that looks something like:
public class callExtension {
    public callExtension(ApexPages.StandardController stdController){
    public Event getEvent(){
        if(event == null) event = new Event();
        event.ownerid = ApexPages.currentPage().getParameters().get('ownerID');
        return event;
        }
    }
}


Thanks again!


Andrew

 
Hi all,

I've been stuck on this for a while, so I'm finally asking for help - issue is similar to this one:
https://developer.salesforce.com/forums?id=906F000000094yFIAQ

I have a Visualforce page that uses the standard Event controller.  I overrode the "New Event" button to direct to this Visualforce page.  I'm having trouble pre-populating certain fields on that page.

For example, {!Event.whoID} is passed in the button URL and pre-populates the appropriate field by default.  I want to pass the User ID too and populate the Assigned To field, but I can't get it to work.  The default New Event page (which uses the same standard Event controller) populates the Assigned To field automatically, and without any additions in the URL... what am I missing?  Does my VF page need a controller extension?  If so, can anyone give pointers on what that needs to look like?

I assume I need to A) include whatever IDs I want populated in a custom button URL, and simultaneously B) build a controller extension that tells my VF page to pull the values out of the URL and load them in my input fields.  But all my attempts to implement this setup so far have failed.

Any pointers will be greatly, greatly appreciated.  Thanks for your help!



VF page snippet:
<apex:page standardController="Event" showHeader="true" sidebar="true">
    <apex:sectionHeader title="Log A Call"/>
    <apex:form id="pageForm">
        <apex:pageBlock title="Call Edit" mode="edit">
            <apex:pageBlockButtons location="both">
                <apex:commandButton value="Save" action="{!save}" id="saveButton"/>
                <apex:commandButton value="Cancel" action="{!cancel}" />
            </apex:pageBlockButtons>
            <br />
            <apex:pageBlockSection title="Owner" columns="2" collapsible="false">
                <apex:inputField value="{!Event.ownerID}" label="Who took the call?" style="width:200px;height:15px;" />
                <apex:inputField value="{!Event.StartDateTime}" label="Start" />
                <apex:inputField value="{!Event.Subject}" label="Subject" />
                <apex:inputField value="{!Event.EndDateTime}" label="End" />
                <apex:inputField label="Person" value="{!Event.whoID}" style="width:300px;height:20px;" />
                </apex:pageBlockSection>
                </apex:pageBlock>
    </apex:form>
</apex:page>

Current button URL (owner ID to be added):
https://c.cs8.visual.force.com/apex/NewLogCall?who_id=XXXX&retURL=%XXXX&sfdc.override=1


Assuming a controller extension that looks something like:
public class callExtension {
    public callExtension(ApexPages.StandardController stdController){
    public Event getEvent(){
        if(event == null) event = new Event();
        event.ownerid = ApexPages.currentPage().getParameters().get('ownerID');
        return event;
        }
    }
}


Thanks again!


Andrew

 
Hi all,

I've been stuck on this for a while, so I'm finally asking for help - issue is similar to this one:
https://developer.salesforce.com/forums?id=906F000000094yFIAQ

I have a Visualforce page that uses the standard Event controller.  I overrode the "New Event" button to direct to this Visualforce page.  I'm having trouble pre-populating certain fields on that page.

For example, {!Event.whoID} is passed in the button URL and pre-populates the appropriate field by default.  I want to pass the User ID too and populate the Assigned To field, but I can't get it to work.  The default New Event page (which uses the same standard Event controller) populates the Assigned To field automatically, and without any additions in the URL... what am I missing?  Does my VF page need a controller extension?  If so, can anyone give pointers on what that needs to look like?

I assume I need to A) include whatever IDs I want populated in a custom button URL, and simultaneously B) build a controller extension that tells my VF page to pull the values out of the URL and load them in my input fields.  But all my attempts to implement this setup so far have failed.

Any pointers will be greatly, greatly appreciated.  Thanks for your help!



VF page snippet:
<apex:page standardController="Event" showHeader="true" sidebar="true">
    <apex:sectionHeader title="Log A Call"/>
    <apex:form id="pageForm">
        <apex:pageBlock title="Call Edit" mode="edit">
            <apex:pageBlockButtons location="both">
                <apex:commandButton value="Save" action="{!save}" id="saveButton"/>
                <apex:commandButton value="Cancel" action="{!cancel}" />
            </apex:pageBlockButtons>
            <br />
            <apex:pageBlockSection title="Owner" columns="2" collapsible="false">
                <apex:inputField value="{!Event.ownerID}" label="Who took the call?" style="width:200px;height:15px;" />
                <apex:inputField value="{!Event.StartDateTime}" label="Start" />
                <apex:inputField value="{!Event.Subject}" label="Subject" />
                <apex:inputField value="{!Event.EndDateTime}" label="End" />
                <apex:inputField label="Person" value="{!Event.whoID}" style="width:300px;height:20px;" />
                </apex:pageBlockSection>
                </apex:pageBlock>
    </apex:form>
</apex:page>

Current button URL (owner ID to be added):
https://c.cs8.visual.force.com/apex/NewLogCall?who_id=XXXX&retURL=%XXXX&sfdc.override=1


Assuming a controller extension that looks something like:
public class callExtension {
    public callExtension(ApexPages.StandardController stdController){
    public Event getEvent(){
        if(event == null) event = new Event();
        event.ownerid = ApexPages.currentPage().getParameters().get('ownerID');
        return event;
        }
    }
}


Thanks again!


Andrew