Record Type change not respected using page assignments

I have a page override that redirects using the Skuid.Redirects class along with Page Assignments based on record type and overriding: New, Edit, and View.

However, we noticed that when a user attempts to change the record type of a record the page assignment redirect omits the new Record Type Id. We logged the redirect from our page and it is indeed sending the RecordType param. 

Is there something, in particular, I need to do to get page assignments to work with Record Type changes?

Hi, John. I’ve tried to repro this, but I can’t seem to make it happen. I might be misunderstanding what you are trying to do. What version are you running? Here’s my VF page:

<page standardcontroller="Account" extensions="Redirects" action="%7B!redirect%7D?objecttype=Account&amp;actiontype=View" readonly></page>

Here’s what my Page Assignment records look like:

AccountTypeOne and AccountTypeThree are the stock Detail Template Page with the Page Title changed to indicate which RecordType the current record is using. I used the stock List Template Page on the Account object and added the RecordType field. On that page, if I change the RecordType field of one of the records, save, and then click on the Name field, it seems to redirect me to the correct detail page. What am I missing?

I should have included this with my post. I am actually handling this from an Apex Controller on a VF page. For a specific record type, I need to use the skuid:page tag so that I can use a remoting call (this was prior to action methods). For all other record types, it should redirect back to skuid to figure out where it goes using page assignments.

Here is a snippet of that code in my controller.

Skuid&#46;Redirects skuidUtil = new Skuid&#46;Redirects(this&#46;Controller);

pageRef = skuidUtil&#46;redirect();
pageRef&#46;getParameters()&#46;put('objectType', 'Opportunity');

Map<string, string> existingParams = ApexPages&#46;currentPage()&#46;getParameters();
if (existingParams&#46;containsKey('RecordType')) {
 pageRef&#46;getParameters()&#46;put('RecordType', existingParams&#46;get('RecordType'));
}

boolean isEditMode = ApexPages&#46;currentPage()&#46;getUrl()&#46;contains(OPPORTUNITY_EDIT_PAGE);

if (isEditMode) {
 pageRef&#46;getParameters()&#46;put('actionType', ACTION_TYPE_EDIT);
} else if (opp&#46;Id == null) {
 pageRef&#46;getParameters()&#46;put('actionType', ACTION_TYPE_NEW);
} else {
 pageRef&#46;getParameters()&#46;put('actionType', ACTION_TYPE_VIEW);
}

Hi, I am just circling back on this as I went back and used your simplified approach of redirecting using the sample you provided.

However, I am still unable to change the record type of a record. The scenario is:

  1. An opportunity exists as RecordType-A and uses the native Salesforce View, Edit, and New screens.

  2. User wants to change the record from RecordType-A to RecordType-B. So the user views the opportunity and clicks the “Change” link next to the record type.

  3. System redirects user to the Record Type selection screen.

  4. User selects RecordType-B and is redirected.

…and this is where the issue occurs. The record type change the user selected doesn’t take. I know that the selection screen doesn’t actually save the change but rather takes the users selection and passes the change on but for some reason this doesn’t work with the skuid redirect. I tried adding the record type param to the URL hoping that would help but it had no affect.

<apex:page standardController="Opportunity" extensions="skuid.Redirects" action="{!redirect}?objecttype=Opportunity&amp;actiontype=Edit&amp;RecordType={!Opportunity.RecordTypeId}" readOnly="true"> </apex:page>

Hi, John. My apologies for the delayed response, and that I’m just now circling back to this too. It looks like our logic for determining which Page Assignment to use is looking for a “RecordType.DeveloperName” value in the “recordtype” param, not a RecordType.Id. Does switching to that make any difference?

If not, I’m still missing something, as it sounds like you are on standard Salesforce screens on steps one to four, but when I start on the standard screen, I get redirected back to the standard View screen for the object (i.e. nooverride=1) after selecting a Record Type. Am I misunderstanding the scenario still?

Sorry for the slow reply on my end. Crazy busy these days. I was able to work around this issue. I think it had more to do with how we were redirecting vs. a real skuid issue. 
But more specifically when on a standard view there is a link next to the record type that allows you to change the record type, this link sends you to the record type selection screen and then it redirects to the edit screen. In our case the override visual force page. For some reason, during that redirect the record type id the user selected was getting dropped. I have modified our override page to avoid redirecting using page assignments, and that solved the issue.