Can we have links of related lists in a VF page - salesforce

I have a VF page in which i have related lists displayed using
<apex:relatedList list="NOTESANDATTACHMENTS"/>
Is there a way i can have the link of the related list on the top of the page like the ones in standard page? The reason for this is that my VF page is pretty long and the user needs to scroll to get the view the notes and attachment list.
is there any way we can achieve this?
Thanks

Not directly, but you can always use anchor links.
Go to related list
...
<a id="mylist" />
<apex:relatedList list="NOTESANDATTACHMENTS"/>

The relationship name for the Notes and Attachments related list has been changed in winter 14 release.
you can show the attachement in the relatedlist tag.
apex:relatedList list="CombinedAttachments" subject="{!$CurrentPage.parameters.id}"
in the VF page if you are using Standard controller then there is no need to add subject attribute.

Related

How to clone specific elements from a visualforce page to another visualforce page

Hello community I'm having an issue, i'm trying to render visualforce pages for a CV but i dont know how o render specific elements, from page 1 to page 2.
For example:
I have a blue column at the left of the CV but i dont know how to repeat only that column in the 2nd VF page.
If someone can give me a help it would be great!.
Are both Visualforce pages using the same Apex controller?
You could pass the data from one 1st page controller to 2nd page controller, then use:
<apex:repeat value="{!blueRows}" var="string" id="blueColumn">
<apex:outputText value="{!blueRowValue}" id="blueValue"/><br/>
</apex:repeat>

Nested layouts in admin-on-rest

I've started investigating admin-on-rest. It works fine for 'flat' REST-endpoints, e.g.:
/posts/
/users/
etc.
But how do I implement nesting? I mean if I click on some post-entry in 'posts' table - I want not the actual post to be opened in a <Show> view, but a list of it's comments (fetched from URL /{postId}/comments)? And I need also to keep the navigation functionality (some back-arrow button or hierarchy in the header to return to previous page).
Is this even possible with admin-or-rest?
If you want to show a list of comments for a post, use the <ReferenceField>. You can see an example in the demo: https://marmelab.com/admin-on-rest-demo/#/customers/77 (click on the "orders" and "reviews" tabs to see an embedded datagrid).
If you want to link to a filtered list of comments from the post list, you'll have to create a custom button component. Once again, you can find an example in the demo: https://github.com/marmelab/admin-on-rest-demo/blob/master/src/segments/LinkToRelatedCustomers.js

How to add a visualforce page to the end of existing page according to a condition?

Suppose we have a custom salesforce controller and a custom visualforce page for it. at the end of the visualforce page I like to evaluate a public member variable of the controller and if it is true I like to add the contents of another visualforce page (e.g. apex/test) to the first page.
<apex:page controller="mycontroller">
...........
my tags and page contents comes here
...........
{!if(my_member_variable == true, attach contents of "apex/test" page to end of this page, "do nothing")}
</apex:page>
How can I do that?
In simple words, I am searching for a command similar to include() on PHP for visualforce.
Thanks,
Sounds like you want to use an apex:include along with its rendered attribute.
<apex:page controller="mycontroller">
<!-- ... -->
<apex:include pageName="TheNameOfTheIncludedPage" rendered="{!my_member_variable}"/>
</apex:page>
Incidentally. The salesforce.stackExchange.com is a great place to ask Salesforce specific questions.

How to display page for testing component with sObject?

I'm new to Salesforce/Apex and I need to be able to test a component I am working on in a separate page.
Here is the scenario. I have the following test page:
<apex:page sidebar="false" showHeader="false" standardController="Contact">
<div id="wrapper" style="max-width:980px;">
<c:djEmailTemplate_MainComponent sObject="{!Contact}" theContactId="{!Contact.Id}"/>
</div>
</apex:page>
I can display the page by adding /apex/testpage to the url after the project name.
What I don't know how to do is to include data to satisfy the parameters (sObject, theContactId) that are needed to populate values in the component.
Can anyone explain how I can do this?
Thanks in advance.
Your test page uses the Contact object as its standard controller, so in most cases you would want to specify a Contact record for the page/controller to operate on. You can use any existing Contact record in your org, or create a new one (specifically you'll want to grab the ID of the record) and then append the ID to the URL you're using like so: /apex/testpage?id=003xxxxxxxxxxxx. This will provide the page and controller a record to pass to the VF component.

Add a custom link/button to a visualforce page?

I have a custom link on the opportunity object which points to an external site. Is it possible to add this custom link to a visualforce page?
The solution I came up with was to copy the url salesforce creates for this custom link, and paste it in the page. It looks something like this:
my custom link
This works fine, however, it won't work once it's in a managed package installed on other servers because the lid param will be different (the custom link id). Is there a solution for this?
Have you thought about putting the URL of the link in a field on the opportunity object and then creating an output link on your VF page?
Paul
Look under $Action. Buttons and links are available via that global variable. For example $Action.Opportunity.CustomLink
To build off the answer from danieljimenez, the $Action global variable provides access to the button/link objects. From there you need to use the URLFOR function to get it into a usable form. Then you can either put it into the action param of a command button, or use it as you'd like anywhere else in your markup.
<apex:commandButton action="{!URLFOR($Action.My_Obj__c.My_custom_link)}" value="My custom button"/>
or
My link
create New Contact (Salesforce button target _blank)
<apex:commandLink target="_blank"
styleClass="btn"
style="text-decoration:none;padding:4px;"
action="{!URLFOR($Action.Contact.NewContact)}"
value="Create New Contact" />

Resources