Can we display a totally different page layout based on a field value using page assignments?

  • 1
  • Question
  • Updated 4 years ago
  • Answered
We want to use the same object called "Rental Listing" for another use. Basically we have rental properties and we also want to include vacation properties. 90% of the fields apply to this record, but we need a bit of a different page layout for the vacation property page. 

We want to show a different layout when a field = a specific value. 

Any suggestions?

I've tried to go into page assignments but that didn't seem to work. 

I do not want to just do field rendering either as a new layout and UX would be more appropriate. 

Suggestions?
Photo of Julien Jacques

Julien Jacques

  • 364 Points 250 badge 2x thumb

Posted 4 years ago

  • 1
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Two ways to go about this. 

1. Make each kind of property a record type in the standard salesforce setup.   Then have page assignments take the user to a different skuid page for each record type.  (see this tutorial

2. Make one page,  but add conditional rendering to adjust the layout appropriately for each scenario. 
Photo of Julien Jacques

Julien Jacques

  • 364 Points 250 badge 2x thumb
Got it! Makes sense. Thanks
Photo of J.

J., Official Rep

  • 7,470 Points 5k badge 2x thumb
Going the RecordType route definitely works and makes the most use of standard Skuid/Salesforce functionality, but Record Types have other uses of course, and you may not want to mess with them (or have to change anything about your data anyway). Just in case this turns out to be true, here's a third option.

It requires a little bit of Visualforce (and maybe Apex depending on how complicated the redirect logic is), but you could make use of the "Other Situation" Page Assignments here too. Create a Page Assignment for each "situation" you want to handle giving each an appropriate value in for Other Situation. Create a Visualforce page which uses the skuid:page component to selectively render the correct Page Assignment. For instance, say you want to show one Edit page for Accounts in the Education industry and another one for every other industry. You could use something like...
<apex:page standardController="Account" readOnly="true">
<!-- Handle situation 1 -->
<apex:outputPanel rendered="{!Account.Industry == 'Education'}">
<skuid:page objectType="EducationAccounts" actionType="Edit"/>
</apex:outputPanel>
<!-- Handle situation 2 -->
<apex:outputPanel rendered="{!Account.Industry != 'Education'}">
<skuid:page objectType="NonEducationAccounts" actionType="Edit"/>
</apex:outputPanel>
</apex:page>
Check out this tutorial for the official writeup.