You need to sign in to do that
Don't have an account?
MXG
Build apex page action with urlfor in controller
Hi Community,
I have created a new 'OpportunityOffer' object and I can only create a new OpportunityOffer object as a child object of an Opportunity.
So I want to override the New button of the OppertunityObject, because I have to set the recordtype automatically. If I have an Opportunity with type (custom field) X, than I have to set the recordtype X for the new OpportunityOffer.
I created the following:
<apex:page standardController="OpportunityOffer__c" extensions="ManualOfferRecordTypeSelectionExtension"
action="{!URLFOR($Action.OpportunityOffer__c.New, null, [retURL=URLFOR($Action.Opportunity.Tab, $ObjectType.Opportunity), RecordType='{!recordType}'], true)}">
My Controller finds the right recordtype - but I think that the action does not wait for the result of my controller - the wrong recordtype is set. I tested to set a recordtype Id into the action, that worked - but not with a controller value.
Is there a way to create the action in the controller? I found nothing in the internet that help me..
I have created a new 'OpportunityOffer' object and I can only create a new OpportunityOffer object as a child object of an Opportunity.
So I want to override the New button of the OppertunityObject, because I have to set the recordtype automatically. If I have an Opportunity with type (custom field) X, than I have to set the recordtype X for the new OpportunityOffer.
I created the following:
<apex:page standardController="OpportunityOffer__c" extensions="ManualOfferRecordTypeSelectionExtension"
action="{!URLFOR($Action.OpportunityOffer__c.New, null, [retURL=URLFOR($Action.Opportunity.Tab, $ObjectType.Opportunity), RecordType='{!recordType}'], true)}">
My Controller finds the right recordtype - but I think that the action does not wait for the result of my controller - the wrong recordtype is set. I tested to set a recordtype Id into the action, that worked - but not with a controller value.
Is there a way to create the action in the controller? I found nothing in the internet that help me..
you can develop the redirection into am method of ManualOfferRecordTypeSelectionExtension extension using pagereference. Thereafter you can also put record type id to that URL. I think it is not happening in your code as generation of {!recordType} is happening later than the page getting loaded.
Thanks,
Prosenjit
Thanks,
Prosenjit