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

Custom VF Page on Case Layout, does it work?
I have created a VF Page that uses the case standard controller plus a custom made controller that returns a recordset that I can iterate through and render nicely on the VFP.
The page is to be embedded in a Case Page Layout.
Now, I want to grab the custom serial number from the case in question and pass it to my controller to be used in the WHERE part of my SOQL query. I figure I should be able to use the <apex:variable> mechanism and pick it up in the controller but I can't save the page because it can't find my custom serial number. Does the VFP live in it's own bubble, blissfully ignorant of the case in context? Or can I somehow traverse the page collection to get to the case page and lift the serial number from it?
In the page: <apex:variable var="srchText" value="{!MySerial_Number__c}"/> In the Controller: strSerial = System.currentPageReference().getParameters().get('MySerial_Number__c');
The error comes when trying to save the page. Error message is Error: Unknown property 'CaseStandardController.MySerial_Number__c'
What to do?
/Mats
If it were me, I'd simply create a list of related cases via a SOQL query in the constructor (based on the record in the standard controller). Then I'd expose these as a controller property and output a datatable based on it.
Something like the following:
Controller:
Page:
All Answers
As you are using the standard controller, the case record will be automatically populated and available to your extension controller or page. You can pull in additional fields by including them in the page but not rendering.
E.g. Page:
Controller:
Thank You Bob!
I saw something like that in this post (http://boards.developerforce.com/t5/Visualforce-Development/error-referencing-field-using-standard-controller-extension/m-p/83237) and tried it before. I will try it again as per your instructions.
To test it properly I need to insert the page into the case page layout. Unfortunately the page is not available in my page layout editor. I thought it would automatically be availabe if you used a standard object as your controller? (at an early stage it WAS available there but a lot of water has run under the bridge since)
My page uses a Custom List Controller but references Cases (plus my own extension) and not the standard one, is that why it's not beeing available? I used the information here to build the controller: http://www.salesforce.com/us/developer/docs/pages/index_Left.htm#CSHID=pages_compref_pageBlock.htm|StartTopic=Content%2Fpages_compref_pageBlock.htm|SkinName=webhelp
/Mats
If you don't use the standard cases controller you won't be able to add the page into the record detail view I'm afraid. Only pages with the standard controller appear in the layout editor.
Once you have it on the page, you are guaranteed to be able to get the record from the standard controller.
I thought I WAS using the standard case controller, I am after all referencing it:
/Mats
This is what screws things up: recordSetvar="cases"
As soon as I changed the page to use recordsets it got disqualified from appearing on case page layouts. Unfortunately, it does not show up under the Related Lists section in the editor instead. That would have been neat.
How do you create your own related lists?
/Mats
You are using the standard set controller, due to the recordSetVar attribute, which is different - it deals with a collection of cases rather than one.
Cross post!
Can you clarify what you are trying to do? I'm a little confused now.
If YOU are confused, imagine me! :P
What I want to do is the following.
When the case officers here take ownership of a new case arriving from the SSP, I want them to be aware of any prior cases filed on the same serial number. Ideally by presenting them with a list of cases that contain the samt serial number when they open the case.
If I can't pass a recordset across, can I pass any other object across that can be parsed and/or iterated through as 5-6 columns by n rows in the client?
/Mats
If it were me, I'd simply create a list of related cases via a SOQL query in the constructor (based on the record in the standard controller). Then I'd expose these as a controller property and output a datatable based on it.
Something like the following:
Controller:
Page:
Thank you Bob!
You are a rock in an unruly sea of doubts, minunderstandings and (my) lack of knowledge! :)
That did the trick, it works like a charm!
With some tweaks and changes it turned out like below.
Page:
Controller:
/Mats