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&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.Redirects skuidUtil = new Skuid.Redirects(this.Controller);
pageRef = skuidUtil.redirect();
pageRef.getParameters().put('objectType', 'Opportunity');
Map<string, string> existingParams = ApexPages.currentPage().getParameters();
if (existingParams.containsKey('RecordType')) {
pageRef.getParameters().put('RecordType', existingParams.get('RecordType'));
}
boolean isEditMode = ApexPages.currentPage().getUrl().contains(OPPORTUNITY_EDIT_PAGE);
if (isEditMode) {
pageRef.getParameters().put('actionType', ACTION_TYPE_EDIT);
} else if (opp.Id == null) {
pageRef.getParameters().put('actionType', ACTION_TYPE_NEW);
} else {
pageRef.getParameters().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:
An opportunity exists as RecordType-A and uses the native Salesforce View, Edit, and New screens.
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.
System redirects user to the Record Type selection screen.
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&actiontype=Edit&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.
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.