You need to sign in to do that
Don't have an account?

Visualforce page is not redirecting to specific VF pages with associated record types.
Hi,
For Account, we have few record types. we want to have the related vf page displayed when a specific record type is selected.
However, upon selecting a record type, the below vf page is not directing the VF new record page specific to record type.
We also have a domain for our instance.
Am i missing something here?
For Account, we have few record types. we want to have the related vf page displayed when a specific record type is selected.
However, upon selecting a record type, the below vf page is not directing the VF new record page specific to record type.
We also have a domain for our instance.
Am i missing something here?
<apex:page standardController="Account" extensions="NewAccountExtension" action="{!redirectToNewVFPage}"> </apex:page>
public with sharing class NewAccountExtension { public String recordTypeId; public NewAccountExtension(ApexPages.StandardController std) { } public Pagereference redirectToNewVFPage(){ Pagereference pg = null; if(ApexPages.CurrentPage().getParameters().get('RecordType') != null){ recordTypeId = ApexPages.CurrentPage().getParameters().get('RecordType'); if(recordTypeId == Schema.SObjectType.Account.getRecordTypeInfosByName().get('Finance_Account').getRecordTypeId()){ pg = new Pagereference('https://avantegrande.cs50.my.salesforce.comapex/fin_new_account'); }else if(recordTypeId == Schema.SObjectType.Account.getRecordTypeInfosByName().get('Logistics_Account').getRecordTypeId()){ pg = new Pagereference('https://avantegrande.cs50.my.salesforce.com/apex/logi_account'); } pg.setRedirect(true); return pg; } return null; } }
I would suggest you debug your code by placing system.debug after if and if else statements.
Also you can just use '/apex/logi_account'
Refer below document
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_system_pagereference.htm
Please mark it as solved if my reply was helpful. It will make it available for other as the proper solution.
Best Regards
Sandhya
Visualforce Error
System.NullPointerException: Attempt to de-reference a null object
Error is in expression '{!redirectToNewVFPage}' in component <apex:page> in page account_redirect: Class.NewAccountExtension.redirectToNewVFPage: line 13, column 1
Class.NewAccountExtension.redirectToNewVFPage: line 13, column 1
can you let me know what i am missing in line 13.