Showing posts with label Sidebar. Show all posts
Showing posts with label Sidebar. Show all posts

Monday, January 2, 2017

Visualforce - Beyond Basics Series 39 - Modern Upload Button

How to upload an attachment to record ?

Using apex:inputFile tag, we can upload a file & store that as the attachment to the record. The master record id should be assigned to parentId for the Attachment.


What is the traditional way ?

Traditionally, developers use the same styling of inputFile as it is. That means there will be an upload button for user to select the file & there has to be a commandButton/commandLink to call the action function.


How to transform that to modern look ?

But, in a modern Upload button solution, a Upload label will be styled as a Button. Then, the inputFile tag will be inside the label & hidden from user. So, user will see only Label(Button), not the acutal inputFile.

Where is the Code ?

Here's the code that illustrates the traditional method & more modern method to upload the file.

Any Screenshots ?



Walk through in a video ?


Tuesday, December 6, 2016

Visualforce - Beyond Basics Series 5 - App agnostic widgets in sidebar

Is there a customization section common to all Apps ?

Yes. Salesforce provides sidebar for this purpose. This sidebar is nothing but a collection of standard & custom components. Standard components include Create New, Recent Items, Tags, Custom Links, Recycle Bin.


What is allowed inside a sidebar component ?

you can have one of the following types for a component,

  1.   Links
  2.   Image
  3.   HTML
  4.   Visualforce


How can we use visualforce ?

Most of the time one can use visualforce to build a sidebar component for one of 3 purposes,

  1.   Output Stats, Quotes, Reminders, Important messages etc
  2.   Input a value from user & take action in Apex
  3.   Set of links for Navigation


Where is the code ?

I have given code for illustrating all these use cases. To try this out,
  1) you need to create a new 'Custom Component' under Setup -> Home -> Home Page Components.
        - with 'visualforce' type, height 200px, narrow type
        - select the visualforce page (copy the code from below)
  2) Then, you need to add this new component into current Home Page Layout.