Wednesday, January 14, 2015

Salesforce: Activity Type reporting

Activity is pretty unique in, it consists of two objects: Event and Task, but it have almost similar structure. When you add a custom field for Activity, instead of click Event field or Task field, but you will find a menu Activity Custom Fields under Activities menu. In structure level, the field will be added in both Event and Task.

Type is standard field in both Event and Task, you can customize to have same values or different between Event and Task.

When come to reporting, you can run a report with combined data between Event and Task, just select standard report type Tasks and Events. Type field will be shown as Activity Type on the report.

We found an issue when would like to group by Activity Type, if both Event and Task have same values, instead of group them into the same group, it will be group into 2 group, one for Event and one for Task.

1. Formula Field
When you create formula field in 'Activity Custom Fields', Type field is not visible for Activity - NOT POSSIBLE.

2. Workflow Rule
- Create a Custom Text field in Activity Custom Field

- Create custom field on Activity
o Name = Type
o Type = Text
o Length = 25

- Create Workflow rule on Event
o Name = Update Type from Event
o Evaluation Criteria = Evaluate the rule when a record is created, and every time it’s edited
o Description = To update custom field Type with event type for reporting purpose
o Rule Criteria = Event: Type NOT EQUAL TO null

- Create Field Update action on Event
o Name  = Update Type from Event
o Field to Update = Event: Type
o Field Data Type = Text
o Formula Value = TEXT(Type)
o Associate this action to above Event workflow and activate the Workflow

- Create Workflow rule on Task
o Name = Update Type from Task
o Evaluation Criteria = Evaluate the rule when a record is created, and every time it’s edited
o Description = To update custom field Type with task type for reporting purpose
o Rule Criteria = Task: Type NOT EQUAL TO null

- Create Field Update action on Task
o Name = Update Type from Task
o Field to Update = Task: Type
o Field Data Type = Text
o Formula Value = TEXT(Type)
o Associate this action to above Task workflow and activate the Workflow

Modify the report to group by custom Type field, see the result below:

If you have any existing data, you need to mass update Event and Task to populate Type to the custom field.

3. Apex Trigger
This is exactly the same logic with using Workflow, since we can use workflow to achieve this, why need to use trigger?

Reference: Reporting on the Activity Type field

Saturday, January 10, 2015

Salesforce: Mail Merge

A mail merge is the process of generating form letters and documents that are personalized for the recipient, who is often get the data from database.

Salesforce have with this functionality from long time back, where you can define templates and to include variables into the document generated, it called merge fields. In Salesforce, you can use data from records, for example Contact Name, Account Name and Address displays in the generated documents.

You can generate single or mass document in Salesforce:

Single Mail Merge Documents
To generate a Microsoft Word document for an individual record, open the record’s detail page and click Mail Merge on the Activity History related list. Just make sure to add Activity History related list to the page layout.

Once you click Mail Merge button, it will open Mail Merge page, record to merge will be automatically populated. For custom object, you will be asked for contact to merge with the Word document.

If you select Log an activity button, new task page will be presented for you to enter information for the task.
Salesforce has ending support for Standard Mail Merge on March 4, 2017, read this.

Mass Mail Merge Documents
It only support Accounts, Contacts, and Leads. Click the object tab and select Mass Mail Merge under Tools.

There are 2 type of mail merge available in Salesforce and you only can activate one for the whole organization:

Standard mail merge
Standard mail merge requires:
- Microsoft® Internet Explorer® versions 7, 8, 9, 10, and 11
- Microsoft Word 2003 or 2007
- Microsoft Windows® XP and Windows Vista® (32-bit only)

For standard mail merge, you will ask to install ActiveX the first time you use it. When you click Generate button, Ms Word opens with your generated document and you can Save As to a folder as per normal Ms Word.

Extended Mail Merge
Extended Mail Merge do not require to any specific browser or specific Ms Word version. To enable Extended Mail Merge, navigate to Setup | User Interface, enable Activate Extended Mail Merge. If you do not see this option, log a case to Salesforce Support to enable it. Once you activate Extended Mail Merge, it will affect to the whole user in the organization, this mean no user will use Standard mail merge anymore.

In Extended Mail Merge, when you click Generate button, the document generated will be put in Salesforce Document object. You get an email with a URL to download generated mail merge documents. Example: Your mail merge request is complete. The generated files have been added to your documents tab:  Please note that these files count towards your organization’s storage limits.

Generate Mail Merge Template
To use mail merge, you need to create mail merge template, which is Microsoft Word documents with merge fields that reference fields.

If you are using Microsoft Word 2002, 2003, 2007, you can use Connect for Office to insert field quickly. If you use newer Microsoft Word, such as version 2010 or 2013, follow this step:
- Place your cursor where you want to insert a merge field.
- Select the Insert tab on the ribbon, click Quick Parts in the Text group, and then click Field...
- Select Mail Merge in the Categories drop-down list.
- Select MergeField in the Field names box.
- In the Field Properties area of the Field name box, manually enter the valid merge field, such as ACCOUNT_NAME.
- Click OK.

You will see the merge field added in Ms Word, such as: Account Name: «ACCOUNT_NAME» 

Save the document and upload to Salesforce from Setup | Communication Templates | Mail Merge Templates

Here is the guide line for the merge field name: ObjectName_FieldName, such as: ACCOUNT_NAME for standard object and field, for custom object is the same OBJECT1_RATING. If you note here, it is a not API field name.

There is a tool SForceMailMerge to help us to get the right merge field name easily:

Change the instance to your Salesforce instance name and put a sample record for that object in id parameter.

  • Not able to replace Mail Merge Templates document
  • Only following fields can be used in merge document:
    • fields from the base object, including formula field and roll-up summary field
    • user fields
    • organization fields
    • today
    • parent object fields for master-detail relationship
  • Not able to use data from child records, you need to use 3rd party app such as: Conga Composer, Drawloop, or S-Docs.


Friday, January 9, 2015

Invite Customers To Chatter

In previous blog, we discussed about Chatter External license and feature. In this blog, we would like to explain step by step how to invite your customers to collaborate using Chatter. You need to consult with your company legal team, but the good thing is, until now Salesforce give 500 Chatter External license for free.

Here is the step to enable and invite your customers, just assume you already get approval from your manager, legal and etc. To invite customer is not just system admin, but users with right permission able to invite their customers to Chatter Group

1. Enable Allow Customer Invitations
Navigate to Setup | Customize | Chatter | Settings
Enable Allow Customer Invitations

2. User permission
Make sure user have Invite Customers To Chatter permission in Profile or Permission Set. Otherwise, user will not see Invite People link

3. Create Chatter Group
Set the group access to Private and enable Allow Customers

4. Member Role
User need to be Manager or Group Owner to able to invite customer. Otherwise, user will not see Add/Remove Members, Change Roles and Invite People link in Chatter Group

5. Invite Customer
User click Invite People link and enter user email address, separate email address by comma for multiple email address.

- Customer will receive email from Chatter and click "Join Now"
- Customer to enter First Name, Last Name, Company Name
- Enter password, confirm password, security question and answer.
- Click Create Account button

If you have validation rule in User object and it cause blocking chatter external user creation, it will throw error message:
There was a problem with our server
Sorry! We're having a problem accessing the page you requested. Please try again later.
Your support reference number is 1346115889-13737 (1226695017)

If everything okay, user will be created in Salesforce and assigned with "Chatter External User" profile. The username will be added with guest before domain name, example :

ReferenceAllowing Users to Invite Customers

Tuesday, January 6, 2015

Salesforce: Activity Visibility Controlled by Parent

In, for Activity objects (Task & Event), there is only 2 options in the Organization-Wide Defaults sharing setting:
- Controlled by Parent
- Private

Only the activity owner (label as Assigned To), and users above the activity owner in the role hierarchy can edit and delete the activity.
Users with Read access to the record to which the activity is associated (Name and Related To) can view and report on the activity.

Controlled by Parent
A user can perform an action (such as view, edit, transfer, and delete) on an activity based on whether he or she can perform that same action on the records associated with the activity.

For example, if a task is associated with the Acme account and John Smith contact, then a user can only edit that task if the user can edit the Acme account and the John Smith contact.

The "parent" of the activity record is:
  • Who Id (Name): Contact and Lead
  • What Id (Related to): Account, Opportunity, Case, Campaign, Asset, and custom objects with Allow Activities enabled.

To edit a task, the user needs to have Edit Tasks permission defined in the Profile or Permission Sets and to edit an event, the user needs to have Edit Events permission defined in the Profile or Permission Sets. Both permissions are located under General User Permissions in the profile, or this permission also can be assigned to specific users using the Permission Set.

When a user creates a task/event, regardless of the parent of the task/event owner, the default task/event will be assigned to the current user, not based on parent record owner.

When the user is assigned to a task/event, the user is able to access and edit the task/event (the user need to have Edit Tasks/Edit Events permission to edit task/event), regardless of the OWD sharing setting for Activity, and even user does not have access to the parent record of that Activity record. This edit access will include users in the higher role hierarchy of the assigned user.

Permissions related to View an activity:
  • Be assigned to the activity, or
  • Be above the user assigned to the activity in the role hierarchy, or
  • Have at least read access to the record to which the activity is associated, or
  • Have the “View All” object-level permission in the related record, or
  • Have the “View All Data” permission

Create an activity:
  • Have the “Edit Tasks” and “Edit Events” permissions; AND
  • Have at least read access to a record, if associating the activity with another record

Edit or Delete an activity:
  • Have the “Edit Tasks” and “Edit Events” permissions; AND
  • Be assigned to the activity, or
  • Be above the user assigned to the activity in the role hierarchy, or
  • Have the “Modify All” object-level permission in the related record, or
  • Have the “Modify All Data” permission

View, add and edit events on other users’ calendars
  • Have the “Edit Tasks” and “Edit Events” permissions to create and edit activities AND
  • Have access to the user’s calendar, which depends on your organization-wide calendar sharing defaults and how the user has set up individual calendar sharing.

Events marked as private via the Private checkbox are accessible only by the user assigned to the event. Other users cannot see the event details when viewing that user’s calendar. 
However, users with the “View All Data” or “Modify All Data” permission can see private event details in reports and searches, or when viewing other users’ calendars.

The user who is assigned to an activity in the Assigned To field is often referred to as the “activity owner”.


Sunday, January 4, 2015

Salesforce1 App from Mobile Browser

This blog is not about older Salesforce Classic mobile app, but the newer app Salesforce1.

For Salesforce users who do not install Salesforce1 mobile app into their smart phone, iOS or Android platform, users still able to get same Salesforce1 app experience using mobile web browser, as long as it is enabled in Salesforce1 Settings. But not all mobile web browser and devices are supported, here is the list of mobile web browser and the devices:
  • Apple Safari browser on iPad 2 and later models (including the iPad mini) and iPhone 4 and later models, with iOS 7 or later.
  • BlackBerry Browser on BlackBerry Z10 & Z30 devices with BlackBerry OS 10.2 or later, not support on BlackBerry Q10.
  • Google Chrome browser on Android phones and tablets, with Android 4.2 or later.
  • Microsoft Internet Explorer 11 browser on Lumia and HTC phones with Windows® 8.1.
For best results, Incognito Mode in Chrome, InPrivate Browsing in Internet Explorer, or Private Browsing in Safari or BlackBerry Browser should be turned off. A Wi-Fi or cellular network connection is required to communicate with Salesforce. If you’re using one of the Salesforce1 apps, you can view your most recently accessed records when your device is offline.

From mobile browser, open, enter your username and password. Once your login credential is accepted, your organization logo will be display as loading page, this is the same experience when opening Salesforce1 mobile app, then it will bring you to the same looks and feels with Salesforce1 app.

By default, the mobile browser app option is turned on for your organization wide, but admin able to configure it whether or not users can access the Salesforce1 mobile browser app when they log in to Salesforce from a mobile browser.

User able to see full / site by selecting Full Site option in Salesforce1 mobile browser menu, and back to Salesforce1 site by clicking Go to Salesforce1 link at the bottom of the page.

1. Salesforce1 Settings
Navigate to Setup | Mobile Administration | Salesforce1 | Settings, tick Enable the Salesforce1 mobile browser app. This allows all users to access Salesforce1 from supported mobile browsers. Deselect this option to turn off the mobile browser app, so users can access the full Salesforce site from a mobile browser instead.

When this option is turned on, users who log in to Salesforce from a supported mobile browser are always automatically directed to the Salesforce1 interface. If you want your users to access the full Salesforce site from mobile browsers instead, deselect this option.

2. Salesforce1 User
You will find this option in User Detail page. This option will only available when "Enable the Salesforce1 mobile browser app" is selected as in step 1 above - Salesforce1 Settings.

Salesforce1 mobile browser app disable

Salesforce1 mobile browser app enable

By selecting this option, user will automatically use the Salesforce1 mobile browser app when they log in to Salesforce from a supported mobile browser. If this option off, user will see normal / full Salesforce site. So, this option DO NOT related with enabling user to access Salesforce1 app using mobile device, see this blog to enable Salesforce1 access by profile/user.

When user login using web browser to access Salesforce1 app, the login history will still show the same browser, example: Safari 7 for iOS.


Thursday, January 1, 2015

SimplySfdc in 2014

We just close 2014 and welcoming 2015.
I would like to share some statistics for SimplySfdc blog on 2014, a blog dedicated to all Salesforce users around the globe. Happy New Year !

Total New Page 108
Total Pageviews 156,448
Channel Source
Search Engine 87.70%
Direct 8.50%
Social Media 2.10%
Referral 1.70%
Top 3 Search Engine Source 
Google 98.73%
Bing 0.91%
Yahoo 0.36%
Top 5 Social Media Source
Google+ 26.24%
StackExchange 21.78%
LinkedIn 17.14%
Blogger  16.69%
Twitter 14.23%
Top 5 Visitor Country
United States 45.22%
India 20.99%
United Kingdom 6.60%
Canada 3.03%
Australia 2.92%
Top 5 Visitor City
Bangalore 5.80%
Hyderabad 3.78%
San Francisco 3.42%
London 3.30%
New York 2.92%
Top 5 Visitor Web Browser
Chrome 70.11%
Firefox 16.31%
Internet Explorer 7.96%
Safari 4.23%
Opera 0.34%
Top 3 Visitor Operating System
Windows 79.73%
Macintosh 15.48%
Linux 1.30%
Top 5 Visitor Screen Resolution
1366x768 26.91%
1920x1080 17.72%
1440x900 9.87%
1600x900 9.62%
1280x1024 7.33%
Top 3 Visitor Mobile OS
iOS 67.29%
Android 31.98%
Blackberry 0.73%
Top 5 Popular Page
Salesforce: Custom Button to pre-populate Fields
Salesforce: ISBLANK() or ISNULL()
Salesforce: Notes and Attachments
Salesforce: How to export Attachments ?

Top 5 Social Referral Page
Chatter Usage and Activity Report

--- Never Stop Learning ---

Page-level ad