Find your content:

Search form

You are here

can we override start field with custom fields in event object

 
Share

can we put custom date field & custom picklist field with no's in it. IN start(SartDateTime) field in event object with trigger code. plz can any one provide me with a sample code please

when event is created for opportunity, date field and picklist field should override the star feild and populate the custom fields values.


Attribution to: rakesh

Possible Suggestion/Solution #1

Step 1: Create a VF page like : New_event_Override:

<apex:page standardController="event" action="{!urlredirect}" extensions="event_override">
</apex:page>

controller:

public with sharing class event_override {
public date custom_date;
public string custom_picklistval;
    public event_override(ApexPages.StandardController controller) {
    custom_date = date.newInstance(2012, 11, 30);
    custom_picklistval = '07:00 AM';
    }
    public pagereference urlredirect(){
    Pagereference page = new pagereference('/00U/e');
    page.getparameters().put('StartDateTime',string.valueof(custom_date.format()));
    page.getparameters().put('StartDateTime_time',custom_picklistval);
    page.setredirect(true);
    return page;
    }
}

NOTE : The way I get the 'StartDateTime' and 'StartDateTime_time' is by going to the input field next to the start right clicking on the field and inspecting element in chrome ( this gives the Id of the field , which we can override)


Attribution to: Rao
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/5622

My Block Status

My Block Content