Pages

Tuesday, September 23, 2014

Visualforce Area for Home Page Custom Component

By Summer '15 release, Home Page Custom Component contains code will no longer supported. Salesforce will remove non-supported code from HTML Area home page components. As a result, components with JavaScript or other advanced HTML elements may stop working properly.

Salesforce advise to use Visualforce Area to replace it, so if you have any exisiting HTML Area component, convert them Visualforce Area. You need to add the new component (and remove HTML Area components) to all Home Page Layouts.

Example: this is your HTML in HTML Area component
<marquee><b style="color: rgb(204, 0, 0); font-family: Arial, Helvetica, sans-serif; font-size: medium;">Salesforce will be conducting emergency maintenance tonight, 14-Oct-14, from 7:00-8:00PM Pacific Time.&nbsp; Salesforce.com will not be available during this time.&nbsp; We extend Salesforce's apologies for this inconvenience.</b></marquee>


1. Create Visualforce page
Setup - Develop - Pages (you can create new Visualforce page directly in Production (although you should built it in Sandbox for testing and approval, and do not need Apex Test Method to deploy from Sandbox instance)

2. Copy the HTML
Put the HTML from existing component into <apex:page>HTML</apex:page> and Save.
Example:
1:  <apex:page>   
2:  <marquee>   
3:  <b style="color: rgb(204, 0, 0); font-family: Arial, Helvetica, sans-serif; font-size: medium;">Salesforce will be conducting emergency maintenance tonight, 14-Oct-14, from 7:00-8:00pm Pacific Time.&nbsp; Salesforce.com will not be available during this time.&nbsp; We extend Salesforce's apologies for this inconvenience.</b>   
4:  </marquee>   
5:  </apex:page>   
3. Create Home Page Components
  • Setup - Customize - Home - Home Page Components, type a name and select Visualforce Area
  • Choose Visualforce Page created above.
  • Set the height, tick Show scrollbars and Label as needed.
  • Save


4. Set Home Page Layouts
  • Setup - Customize - Home - Home Page Layouts
  • Edit each Home Page Layout,  you should see new Visualforce Area component created in Components to Show, enable that component
  • Next
  • Adjust the order Up / Down
  • Save



How to enable Salesforce1 access by Profile / User?

By default, all users able to login to Salesforce.com able to login to Salesforce1 mobile app. But, can we control Salesforce1 app only for some users or by user profiles?  YES, here we go:

1. Setup Connected Apps
  • Setup - Manage Apps - Connected Apps, select both Salesforce1 for iOS and Salesforce1/Chatter for Android as user may use both devices.
  • Click Edit next to Salesforce1 for iOS
  • Change Permitted Users under OAuth policies from All Users may self-authorize to Admin-approved users are pre-authorized
  • To enhance security, you can enable PIN under Mobile Integration in this page
  • Save
  • Repeat the same for Salesforce1/Chatter for Android


2. Enable Profiles or Permission Sets
  • Once step 1 above done, click on Salesforce1 for iOS & Salesforce1/Chatter for Android link (not Edit link)
  • You will notice Profiles & Permission Sets related list added (this is because Permitted Users now is set to Admin-approved users are pre-authorized)
  • Click Manage Profiles or Manage Permission Sets button 
  • Select Profiles or Permission Sets to enable
  • Save
You can do the same from Profile page as well, look for Connected App Access section, then enable Salesforce1/Chatter for Android and .


The same for Permission Set:



When Permitted Users set to All Users may self-authorize, user will see below screen to self approve



Once it change to Admin-approved users are pre-authorized, for user not in the approved list, user will see error below:


You can monitor user login using Salesforce1 from Login History, see Application column.

Note: until Winter '15 release, even access to Salesforce1 is not success, because user is not in approve list, but login history Status for that login is still captured as Success.




Reference: Editing a Connected App



Sunday, September 21, 2014

Best Practice Importing Data to Salesforce


Assume you already know how to load data Salesforce. In this blog, we'll use Data Loader as tool to import to Account records.

1. Data Clean up
Before loading data to Salesforce, data steward need to prepare the data to make sure data is:
  • Clean & no duplication
  • Accurate & Reliable
Bad data will cause: 
  • Decrease user adoption
  • Unusable report
  • Untrustworthy data
  • Reduce Productivity
  • Maintenance nightmare
It is suggest to clean the data before load to the system, take some efforts to get it clean and accurate, it will cost you more to clean the data if already loaded into system.

2. What to Clean
  • Delete duplicate records
  • Correct spelling and punctuations error
  • Naming convention
  • Make sure all required field is populated

3. Prepare Your Data
  • Make sure all fields to follow naming convention, example: for country, use SG instead of Singapore or SGP. Same for the phone country code and area code
  • Change row header match to field name, this will save you time and confirm it is the right mapping
  • Set correct record ownership, add OwnerId column, make sure all record have the right OwnerId, you may need to use VLOOKUP() function if using Ms Excel to prepare data
  • Split the data, if your Account have point to another Account, example: Parent Account, load account without Parent Account first, so you can get the Account Id 

4. Prepare Salesforce
  • Check all unique values from source data map to Picklist field in Salesforce, make sure they are all exist in Picklist values, unless it is no longer use in the future
  • It is good to store unique Id from the source data (if any), this will help you to confirm data is loaded correctly and your user may need this on transition period
  • Check data visibility setting: Roles, Profiles, Sharing Rules

5. Load Data
  • Test batch of 5 records only & verify it in a Sandbox instance
  • Load the rest of records (exclude 5 records loaded in test batch)
  • Optional: deactivate validation rule and workflow rule, this is depend on the need, example: you do not want workflow to trigger 1000 email alerts to Opportunity owner.
  • If everything looking good in Sandbox, repeat the steps to Production

6. Make Data Clean and Valid
  • Validation Rules
  • Picklist, Multi-Picklist, Lookup fields
  • Workflow Rules
  • Formula Fields
  • Record Type
  • Page Layout with Required & Read-Only field
  • Field-Level Security





    Saturday, September 20, 2014

    How to modify Recent items in Salesforce1 ?

    If you aware in Salesforce1 mobile app (as of version 6.0.2), recent items will show the record name and one more field.


    For example Contact, as in screenshot above in red box display Contact name and Account name as the second line. The blue box is some of the list views available for the user.

    If you need to show other field in second line, in this example is Account name to Title, how to modify it?

    1. After you login to Salesforce.com, go to Setup - Customize - Contacts - Search Layouts - Search Results

    2. Click Edit link

    3. Top 2 selected fields will be show in Salesforce1 mobile app

    4. Add new field selected or change the field order

    5. Refresh in Salesforce1


    Notes:
    1. The change in Search Result will effect to ALL users including search in Salesforce website 
    2. If you are using one/one.app emulator to test (example: https://na3.salesforce.com/one/one.app), it will just show first line, which is record name
    3. If you are using Google extension Salesforce1 Demo to show particular record, it will just show first line only, so the best still to test it in the real mobile app.



    Thursday, September 18, 2014

    Salesforce: Report Drill Down and more ...

    For many Salesforce admin using report for their daily work, sometimes we just ignore items in the report, but it is very useful to help our work.

    Drill Down
    The Drill Down picklist and button allow users to report and filter Reports on the fly right from the Run Report page without clicking the Customize button.

    If you aware, when running a Matrix or Summary report, there will be checkbox for each group.


    At the bottom of the report, there is drill down picklist and button.


    Select checkbox (for this example: Opportunity Owner) then select a value to drill down (example: Industry from Account object) and click Drill Down button. It will run the report with filtered by the Opportunity Owner and group by Industry.


    If you save the report, the filter and group will become permanently save.


    Report Option
    For Matrix report, you will find 2 "Summarize information by:" at the report option. The left one would be for row group and the right one for column group. You can change this value on the fly without customize the report.



    While for Summary report only have 1 "Summarize information by:" for the first grouping.


    Additional Option
    On top of Show and Time Frame, for some standard object, such as Opportunity, you will find Opportunity Status and Probability option.


    While for Case, we will have Units option.



    Reference: The Report Run Page



    Wednesday, September 17, 2014

    Salesforce: Send Email Alert for Case Comments

    Use Case: a team of user (case creator, case creator manager, case owner) need to get email alert when a case comment added to case.

    For those who not aware, we can add most recent comment added to the Case in email template
    using merge field {!Case.Last_Case_Comment}


    Using out-of-the-box feature
    Workflow have to trigger from Case Comment object, not from Case object. This mean, email alert also should trigger from Case Comment, not from Case.

    1st issue, when user add comment and not marked it as Public, Most Recent Public Case Comment is previous Comment added and mark as public, so that comment will be deliver to user email, which is not correct. We can fix this by adding IsPublished = True into the workflow Rule Criteria, so user will not get email if it is not marked as Public. This is NOT FIT with the needs.

    2nd issue, as we use Case Comment as the object in Email Alert, we cannot deliver the email to specific recipients, that information only available in Case level. This is Issue.

    Side note: Case comments marked Public will be display in Customer Portal, Self-Service Portal, Chatter Answers, Salesforce to Salesforce. Otherwise, they don't display to those channels.


    Here what we did as the workaround:

    1. Create a Long Text Area field in Case to store 'Most Recent Public Case Comment' added

    2. Create a workflow in Case Comment with Rule Criteria = True; and Evaluate the rule
    when a record is: created

    3. Create Field Update in Case Comment as action for workflow (step 2), update custom 'Most Recent Public Case Comment' in Case from CommentBody (cross object workflow). This will always bring most recent case comment, regardless it is Public or not.


    4. Create another workflow in Case to check if custom {!Case.Last_Case_Comment} is changed - ISCHANGED( Most_Recent_Case_Comment__c )


    5. Create Email Alert in Case for Workflow (step 4)
    Instead of using standard field {!Case.Last_Case_Comment} in the email template, you need to use the custom field created above (step 1).


    Reference:
    Creating and Editing Case Comments on Case Detail Pages


    Page-level ad