Generating help pages for custom objects using Visualforce and a PDF document

In this recipe, we will step through the process of adding a custom PDF document for the purpose of showing help information. This help information will then be accessible from appropriate custom object records to provide for context-specific help information.

Getting ready

Create or retrieve a PDF document that contains the required help information. Here we have an example file that is called HelpText.pdf.

Upload the PDF document into Salesforce as a static resource by carrying out the following steps:

  1. Create or source a suitable PDF to be used to show help information.
  2. Navigate to the Static Resources setup page, by clicking along the following path: Your Name | Setup | Develop | Static Resources.
  3. Click on New.
  4. Enter the name of the static resource in the Name field. For this recipe, type the text CustomObjectHelpText.
  5. In the File uploader control, click on the Browse... button to select the document to upload from your computer. For this recipe, choose the document identified in step 1.

    Note

    Ignore the Cache Control pick list selection and leave it as the default Private value (Cache Control is only relevant to static resources used in the Force.com sites).

  6. The Static Resources setup screen appears as shown in the following screenshot:
    Getting ready
  7. Click on Save.

Now that we have a PDF document stored within Salesforce, we can reference the document from within a Visualforce page. This Visualforce page can then be accessed from the link called Help for this Page link, which is displayed on a custom object record detail page.

How to do it...

Carry out the following steps in order to generate a help page for custom objects using Visualforce and a PDF document:

  1. Navigate to the Visualforce pages setup screen, by going to Your Name | Setup | Develop | Pages.
  2. Click on New.
  3. Enter CustomObjectHelpText in the Label field.
  4. Accept the default CustomObjectHelpText in the Name field.
  5. Paste the following code:
    <apex:page sidebar="false" showHeader="false" standardStylesheets="false" 
          action="{!URLFOR($Resource.CustomObjectHelpText)}">
    </apex:page>
    How to do it...
  6. Click on Save.
  7. Now set the security for the required profiles in your organization by going to Your Name | Setup | Develop | Pages.
  8. Locate the row for the Visualforce page CustomObjectHelpText and click on the Security link.
  9. Set the security for the required profiles.
  10. Now, set the Visualforce page as the resource behind the Help for this Page link by navigating to your custom object customization setup page.
  11. In this recipe, we have a custom object named myCustomObject. Here we proceed by going to Your Name | Setup | Create | Objects | myCustomObject.
  12. Click on Edit.

    Note

    Here, we are presented with the Custom Object Definition Edit page.

  13. In the Context-Sensitive Help Setting option, select the Open a window using a Visualforce page choice.
  14. In the Content Name pick list, select the Visualforce page called CustomObjectHelpText that we created previously as shown in the following screenshot:
    How to do it...
  15. Finally, click on Save.

How it works...

From within the detail page of a custom record, we are presented with a link (at the top right-hand side of the page) called Help for this Page as shown in the upcoming screenshot.

When clicking on the Help for this Page link, the PDF document that we uploaded previously is opened in a new window as shown in the following screenshot:

How it works...
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.85.135