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
stunaitestunaite 

$Action to redirect to Standard Page (recordtypes problem)

Hi!

 

I have created 2 different record types to Campaign.

 

rectype1 uses a standard page layout (lets call "STDCampaign")

rectype2 should use a Visual Force Page (lets call it  "Rectype2_VFP")

 

When I press "New" to create a campaign one page is showed (lets call it "RecType Page")  with a dropdown so I can choose the recordtype of the new object. After choosing I have to press "Continue" button.

 

Overriding the "New" button to a VisualForce Page (lets call it "redirect page") I intend to check what recordtype object is being created and redirect the flow to the right page:

 

if it is rectype2 I redirect it to  "Rectype2_VFP" ->  {!urlfor($Page.Rectype2_VFP)} 

 

if it is rectype1 Iamtrying to redirect to  "STDCampaign" -> {!urlfor($Action.campaign.new)} but unfortunately it is redirected to "RecType Page".

 

So I have to replace  {!urlfor($Action.campaign.new)} for something to overlap the "RecType Page" and goes straight to  "STDCampaign". 

 

here is the page:

 

<apex:page standardController="campaign" 
action="{!if($CurrentPage.parameters.RecordType = '012P0000000CqIX',urlfor($Page.SEP_CompetitionCreation),urlfor($Action.Campaign.new,$CurrentPage.parameters.RecordType))}">
</apex:page>

 

'012P0000000CqIX' is the recordtypeID for rectype2.

 

 

Any idea will be very appreciated!