Page Assignment To VisualForce page?

  • 1
  • Question
  • Updated 2 years ago
  • Answered
This likely isn't possible, but I'm desperate so I figured I would ask anyways...

I have a skuid page that is wrapped by a VF page so that I can make JS Remoting calls to an apex controller.



<apex:page docType="html-5.0" readOnly="true"
controller="MyRemotingController">
<skuid:page page="MySkuidPage" />
</apex:page>


My client wants this page to override the default "view" action for the object.

I can get it to override to the SKUID page no problem, but obviously my JS remoting calls don't work unless on the VF Page.

Is there anyway to point your page assignment tool to a VisualForce page instead of the SKUID page?

I now realize that I probably should have use Rest API instead of JS Remoting, but the deadline is coming up and there is no going back.
Photo of Charlie Jonas

Charlie Jonas

  • 670 Points 500 badge 2x thumb

Posted 5 years ago

  • 1
Photo of Zach McElrath

Zach McElrath, Employee

  • 48,984 Points 20k badge 2x thumb
You should be fine if you just shift MyRemotingController to be an extension controller, rather than a primary controller --- then you can use the standardController for the object and still have your JS Remoting endpoints.



<apex:page docType="html-5.0" readOnly="true" standardController="My_Object__c"
extensions="MyRemotingController">
<skuid:page page="MySkuidPage" />
</apex:page>

Photo of Zach McElrath

Zach McElrath, Employee

  • 48,984 Points 20k badge 2x thumb
Also, it's worth noting here that true Skuid Page Assignments can be run from within the skuid:page component --- that is, from within a Visualforce Page.

So if you have created true Page Assignment records from the Skuid Page Assignments tab, say a page Assignment for "Account", "View", Organization Default, Page=MySkuidPage.

Then you could "execute" Skuid Page Assignments from the skuid:page component like so:



<apex:page docType="html-5.0" readOnly="true" standardController="Account"
extensions="MyRemotingController">
<skuid:page objectType="Account" actionType="View" />
</apex:page>

Photo of Charlie Jonas

Charlie Jonas

  • 670 Points 500 badge 2x thumb
Hmmm... I'm not quite sure this is what I need. Are you saying to set the view Override to point to my VF page? I forgot to mention this key little bit of info in the question, but I only want to override the layout for single a Record Type.
Photo of Zach McElrath

Zach McElrath, Employee

  • 48,984 Points 20k badge 2x thumb
Yes --- what you want to do is to set the View override to point to this exact Visualforce Page, but then you want to create at least 2 Page Assignment records:

OBJECT---------ACTION--APPLIES TO---RECORD TYPE--------Page
1. Your_Obj__c----View------Org Default----Any Record Type---(Use standard layouts)
2. Your_Obj__c----View------Org Default----Your_Type--------MySkuidPage

Then you need to use the following syntax for your Visualforce Page, say "YourObjectView":



<apex:page docType="html-5.0" readOnly="true" standardController="Your_Object__c"
extensions="MyRemotingController">
<skuid:page objectType="Your_Object__c" actionType="View" />
</apex:page>



What this will do is to run Skuid Page Assignments in context of the record it is handed. If the Record is of Record Type "Your_Type", then it will load up MySkuidPage. Otherwise, it will redirect the user to the standard Salesforce View layout that would ordinarily be used for the record.

From Your Object's "Buttons, Links, and Actions" area, you should assign the above "YourObjectView" Visualforce Page to be the override for the "View" action.
Photo of Charlie Jonas

Charlie Jonas

  • 670 Points 500 badge 2x thumb
Once again, exactly what I need. I should probably just give you half my paycheck this week ;)
Photo of Glenn Elliott

Glenn Elliott, Champion

  • 7,738 Points 5k badge 2x thumb
Wow, that's some offer. I'll keep an eye out for your future posts to see if I can help too.
Photo of Jacob Flatter

Jacob Flatter

  • 338 Points 250 badge 2x thumb
Still confused on whether or not the "Standard Layouts" can somehow point to a custom VF page.
Photo of Jacob Flatter

Jacob Flatter

  • 338 Points 250 badge 2x thumb
Thats not the end of the world, but can you see how an org which is trying to move away from custom VF pages would like to roll out Skuid to a subset of users before the entire org?
Photo of Zach McElrath

Zach McElrath, Employee

  • 48,984 Points 20k badge 2x thumb
Absolutely, it's a great idea that's on our todo list. Would definitely help accelerate roll-outs of Skuid with pre-existing Visualforce.
Photo of Jacob Flatter

Jacob Flatter

  • 338 Points 250 badge 2x thumb
Is the following a bad idea?  It worked for me:

<apex:page standardcontroller="Account" Extensions="NewCompany" sidebar="true" deferLastCommandUntilReady="true" action="{!CASE($Profile.Name,    'System Administrator','https://skuid.cs16.visual.force.com/apex/skuid__ui?page=SkuidNewCompany',
    ''
 )}">


Photo of Zach McElrath

Zach McElrath, Employee

  • 48,984 Points 20k badge 2x thumb
Nope, that's the way to do it.
Photo of and thorough

and thorough

  • 736 Points 500 badge 2x thumb
Any updates to this?  I am phasing out some VF pages for Skuid pages.  One record type still needs VF and others go to standard page layouts.  Does anyone have an example for how to set this up?  The Skuid page assignments by record type work well for redirecting to a Skuid page or standard layout, but just need the one straggler record type to go to VF and am not sure how to set up the redirects in VF.  Before adopting Skuid, I had a custom controller extension "dispatcher" handling the redirect by record type, but am having trouble incorporating a Skuid page into the dispatching.  Thanks for any guidance or examples!