Pages

Sunday, January 26, 2014

Salesforce: Default Lead Conversion

In previous blog, we discuss about validation rule when user convert lead. Now, we have new requirement, can we set default values when user click Convert button in Lead?

By default there is no function  from Salesforce to set the default value, but there is a workaround for this, which is adding parameters to the URL. Here we go:

1. Create custom Convert button
Use this button instead of standard Convert button.
  • Go to Setup - Customize - LeadsButtons, Links, and Actions
  • Click New Button or Link
  • You can select Content Source = OnClick JavaScript

  • or Content Source = URL

  • Example: if you want default "Do not create a new opportunity upon conversion" is checked, add this formula in the formula field:
    • JavaScript: window.location.href="/lead/leadconvert.jsp?retURL={!Lead.Id}&id={!Lead.Id}&nooppti=1"
    • URL: /lead/leadconvert.jsp?retURL={!Lead.Id}&id={!Lead.Id}&nooppti=1

2. Edit Lead Page Layout
Remove standard Convert button and add new custom button created in Lead page layout, you can the button name  different.
  • Go to Setup - Customize - Leads - Page Layouts
  • Click Edit link for page layouts
  • Select Buttons in the layout
  • Drag and drop the button to add and remove 


Here list of parameters you can use in the custom button:
Convert Lead
  • "Do not create a new opportunity upon conversion" checked -- nooppti=1
  • "Send Email to Owner" checked -- sem=1
  • "Opportunity Name" -- noopptt={!Lead.Name} - opty
  • "Converted Status" -- cstatus=New Status
Task Information
  • "Subject" -- tsk5_fu=Mission Critical Task
  • "Status" -- tsk12_fu=Deferred
  • "Priority" -- tsk13_fu=High
Description Information
  • "Send Notification Email" -- email_followup=0
  • "Comments" -- tsk6_fu=No Comment
Reminder 
  • "Reminder" -- IsReminderSet_fu=0

You can check more fields you can pre-populate by default or if you have custom Task field to add, go to View Source by right click the page and look for name related to the field, example: <input  id="00N50000002DnFJ_fu" maxlength="200" name="00N50000002DnFJ_fu" size="20" type="text" /> For this example, the parameter would be 00N50000002DnFJ_fu=abc

Hope this help Salesforce admin.


Friday, January 24, 2014

Salesforce: Phone call from Smartphone

This blog is not related to Salesforce1 platform or mobile app promoted in Dreamforce '14. But, we have a use case, when user would like to call a number using smart phone or tablet when browsing from Salesforce.com website.

Here is the scenario, sales rep would like to call a Contact in Salesforce. Rather than to remember or copy the number to a paper, can the sales rep call directly from Salesforce webpage since he use his smart phone to browse Salesforce?

Phone field in Salesforce is not click-able, so by default, there is no way to call from Salesforce website. But, we have the workaround to use a formula field.

So, here we go:
  • Example to use standard Phone field in Contact object 
  • Create a formula field with return type = Text
  • Use this formula = HYPERLINK("Tel:" & Phone, Phone )
  • Add the formula field to Contact page layout, you may remove the default Phone field from page layout to avoid confusion
User will see this new field in page layout and it is click-able. Screenshot below taken from when user click the Phone formula field.




Wednesday, January 22, 2014

How to mass follow user or record in Chatter?

I blog about how to query records followed by users in Chatter last year. I get another requirement recently if it is possible to mass follow users to a record or user. YES, it is possible. We can use the same way as my previous blog above for this purpose.

Use Data Loader to create new records in the EntitySubscription object.

Only 2 fields you need to put in the CSV file:
1. ParentId : user / record to follow
2. SubscriberId: follower

You can use the same way to mass unfollow, this is the same with mass delete records in EntitySubscription object, but make sure you prepare the data correctly in CSV file, you just need to provide EntitySubscription Id.

Note: one user only can follow a maximum of 500 records (include users), see this document. But, you can request Salesforce support to increase this limit.

Reference:

Tuesday, January 21, 2014

Salesforce Pre-Release Registration

In every quarterly Salesforce release, 1-2 month before new release in selected sandbox instance, Salesforce will give chance to users to try Pre-release environment. User can signup from a form given, watch chatter group in Success - Release Readiness in Success Community. For Spring '14 release, here is the signup form.

The small issue here, it ask for email, but no username, as we aware that we can have different username and email address in normal Salesforce login. When you register with your existing email address, it will say "an account with this email address is already in use."

The simple solution is to create new email address in Gmail.com or Yahoo.com, but for many people (including me), it will be a bit troublesome to write that email address to remember it, although you can use tool like Evernote to remember it.

In Gmail, all characters anything after and including the "+" sign will be ignored.
Example - these are all the same:
johan@gmail.com
johan+test@gmail.com
johan+salesforce@gmail.com

All samples above will reach email johan@gmail.com (note this is just a sample, not my real email address).

So, we can make use of this for to register for Salesforce Pre-release, so register with johan+spring14@gmail.com will allow you to register without creating new email address :) 


Monday, January 20, 2014

Salesforce: View All Forecasts permission

This blog only applicable for Customizable Forecasting and not Collaborative Forecasts or Forecasts (Classic).

There are 3 permission related to Customizable Forecasting in Profile, they are located in General User Permissions.

Override Forecasts
Allows users to override their own forecasts and forecasts for users below them in the forecast hierarchy. All standard profiles except Read Only receive this permission.

Edit Personal Quota
Allows users to change their individual quotas. All standard profiles except Read Only receive this permission.
Users with the “Manage Users” permission can always edit any quota. Users can always edit the quotas of users that report directly to them.

View All Forecasts
Allows users to view any forecast regardless of their place in the forecast hierarchy. The System Administrator profile includes this permission.

As system admin, we need to make sure above permissions are given correctly. Otherwise, it may cause big issue.

Scenario: my user create a dynamic dashboard from Customizable Forecasting: Forecast Summary report type. When dashboard is viewing as a Country Manager, it suppose to show only forecast and closed amount from Sales Rep in the country based on Role hierarchy. But in this scenario, the Country Manager can see ALL Sales Rep from ALL country, which is not correct.

Solution: found it caused by the Country Manager profile have View All Forecasts permission granted.

A trace back, we give Country Manager profile this permission because there is a dashboard view as Region Manager and not as Forecast Manager. This user is assigned to the same profile but in the higher role hierarchy. After change the Forecast Manager to Region Manager and remove View All Forecasts, all working good.

Note: you can only have one Forecast Manager in a Forecasts Hierarchy. To setup Forecasts Hierarchy, go to: Setup - Customize - Forecasts (Customizable)- Forecasts Hierarchy

Key takeaway: Users with the “View All Forecasts” permission can see all forecast data of any user in your organization. It is recommended that you do not give this access to all users.


Reference:

Salesforce: How to edit Dated Exchange Rates ?

Salesforce support multi-currency by default, but you need to request Salesforce Support to activate it and inform them the default corporate currency to use.

Then, you can enable Dated Exchange Rate to define exchange rate for every period (month, quarter or year).

Note: dated exchange rates are not currently used in forecasting, currency fields in other objects, or currency fields in other types of reports (see this article). So, make sure you keep updating Conversion rate in-sync with Dated exchange rates. Otherwise, forecast report will report different value with opportunity report (for example).

Once you enter the dated exchange rates, you will not see edit link/button in Active Currencies page.



To edit the rate, click the Currency Name link, it will show history of the rate, then click Edit link to change the rate, or Del link to delete exchange rate for a period.



Another way is to update using API, look for object DatedConversionRate with field name ConversionRate. You can use Developer Workbench to update this easily. Query the object and choose update from Id.
SELECT Id, IsoCode, ConversionRate, StartDate, NextStartDate FROM DatedConversionRate ORDER BY NextStartDate DESC




Search everything related to Salesforce

This would be a very short blog. I found this very useful website that search everything under the sun related to Salesforce.com, it search from docs, boards, blogs, code, any many more. Although, google.com is my personal best search tool (include to search Salesforce related).


http://findsf.info



*** I do not know who is the owner of this site, just sharing info, sharing is caring, sharing is loving.


Sunday, January 19, 2014

Mass deactivate Salesforce Validation Rule or Workflow Rule

As of now Winter '14 release, Salesforce do not have switch to mass turn OFF and ON Validation rules and Workflow rules. In some use case, we need to turn it off, such as in event of mass load data.

But, using some trick, we can make use of Custom Setting as a master switch. Custom Setting is mostly used by developer and not famous among Salesforce admin. I blog about custom setting sometime last year, read here.

Here is the step, let say we want to deactivate all Validation rule in Account:

1. Create Custom Setting
  • Setup - Develop - Custom Settings
  • Click 'New' button
  • Enter Label 'Master Validation', Object Name, Description and select Setting Type = Hierarchy
  • Save


2. Create Fields in Custom Settings 
  • Continue from step 1 above, in custom setting created 
  • Click 'New' button in Custom Fields related list
  • Select Checkbox field type
  • Enter field name and label 'Account Active'
  • Enter Description and Help Text as necessary, Default Value does not really mattered.
So, this is what we have now after add field.


3. Manage Custom Settings 
  • Click Manage button for that Custom Setting to set Default Organization Level Value
  • You should see all fields available 
  • Click Edit button and make sure 'Account Active' is checked
  • Save


4. Field Value for User or Profile (Optional)
You also can determine each user Profile value, users or profiles not added here will use Default Organization Level Value set in step 3 above.
  • Click New in Manage Custom Setting 
  • Select user or profile in the lookup window
  • Check active checkbox button
  • Tips: if you just need to deactivate validation rule only to a profile, example: only for System Administrator when he load data using Data Loader, you just need to add 1 profile here to deactivate the value and let the rest of profiles Active via Default Organization Level Value.


5. Modify Validation Rule
Add following formula '$Setup.Master_Validation__c.Account_Active__c' in Error Condition Formula.

6. Done


Summary:
  • Pro: Admin have full control to ON or OFF validation rule and workflow rule based on Object and Profile (or even User)
  • Cons: Each existing validation rule and workflow rule need to modify and add additional formula into the formula.

Friday, January 17, 2014

Salesforce: How to modify columns in Recent Object view?

Recent object view is one of the view, most viewed by all Salesforce users by default, because when a user click a tab, Recent object is the default view, unless you modify it. We discussed on how to modify default view in object Tab in previous blog.

So, how to modify the columns Recent Object when user click Object Tab?

1. Standard object (example: Account)
  • Go to Setup - Customize - Accounts - Search Layouts 
  • Click Edit link on Account Tab
  • Select fields to show for Recent Tab



2. Custom object
  • Go to Setup - Create - Objects 
  • Find the custom object and click the object name
  • Scroll down to Search Layouts 
  • Look for object name Tab and click Edit link
  • Select fields to show for Recent Tab

Note: this changes will affected to ALL users, so make sure to communicate with users and approval (based on your company policy)

Thursday, January 16, 2014

Salesforce: Accept Queue in Page Layout

A Queue can to support multiple object: Case, Lead and Custom object with list of users.

View
When a queue is created for an object, example Case, by default, a View will with the Queue name will be created in Case View. This View will filtered by owner of the Queue name. The View will be visible for All Internal Users.

Case assign to a queue will be shown in that View.

Accept Queue
By default, user in the Queue will see all Case owned by that Queue in the View. User would like to accept that Case just need to click Accept button in the View.

But, usually user need to go into the case detail before Accept the case, so it is not really user friendly if user have to go back to the View to Accept it. It would be nice and more efficient if user able to Accept case directly in the Case detail page.

By default, this is not possible, but with simple tweak, it is possible. Here you go:
  1. Create a custom button in Case object. Follow this step:
  2. Setup - Customize - Cases - Buttons, Links, and Actions
  3. Click 'New Button or Link', select 'Detail Page Button' in Display Type and Behavior select 'Execute JavaScript'
  4. Paste script below
  5. Add custom button created to the Case page layout.
  6. Done

The script:
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")} 
var CaseObj = new sforce.SObject("Case"); 

var caseOwner = '{!Case.OwnerId}'; 
var caseOwner3 = caseOwner.substring(0,3); 
//window.alert(caseOwner3); 

if(caseOwner3=='00G') 

//window.alert("assign case to user"); 
CaseObj.Id = '{!Case.Id}'; 
CaseObj.OwnerId = '{!$User.Id}'; 

var result = sforce.connection.update([CaseObj]); 
location.reload(true); 

else 

//window.alert("just alert"); 
window.alert("This Case has been handled by someone else"); 
location.reload(true); 
}

This script will check if Case owner is not a Queue, it will not allow user to accept it.
You can enhance with different type to hide Accept button for Case not owned by Queue.

Tuesday, January 7, 2014

Salesforce: find email template associated to which email alerts

This blog in particular is about how to know which email template is associated to which email alerts.

Imagine if you have thousand of email templates created over years by users, how do you able to track if an email template is used in which email alerts of workflow?

Here are the steps on how to create a list view under email alerts:
  1. Click your name and click on Set Up.
  2. Under workflow and approvals click on Email Alerts
  3. On email alerts click on Create New View
  4. From the filters on the view, select Email Template Name field and type in the Email Template Name you would like to check, as your basis to filter.
  5. Click Save and you should be able to see all the email alerts associated with the email template.


More information on Salesforce on Managing Email Alerts and Creating Custom List Views

Monday, January 6, 2014

Salesforce: Approval Process status (2)

Last year, I blog about how to get Approval Process status using SOQL query to ProcessInstance object, see this blog.

Query to ProcessInstance (04g) will give you Status of approval, together with the date/time of when approval submitted and user submit it, see CreatedDate and CreatedById field.
Note: LastModifiedDate and LastModifiedById will NOT change when a user approve / reject an approval request)

If you need more information, such as:
  • Approver username
  • Original approver username
  • Date/time for each transaction
  • Step Status
  • Comments
You can query from ProcessInstanceStep (04h) object, example:
SELECT p.Id, p.ActorId, p.OriginalActorId, p.StepStatus, p.Comments, p.CreatedById, p.CreatedDate, p.ProcessInstance.Status from ProcessInstanceStep p WHERE p.ProcessInstanceId = '04g500000029HCmAAM'



ActorId is the user who is currently assigned the approval step, while OriginalActorId is the user who was originally assigned to this approval step. Query to this object will give full information on the approval steps for each approval.

Another object related to approval, it is ProcessInstanceWorkitem (04i), this object will stored all approval pending request. Meaning approval that has been approved, rejected and recalled will no longer available here. Sample query:
Select p.Id, p.ProcessInstanceId, p.ProcessInstance.Status, p.ProcessInstance.TargetObjectId, p.ActorId, p.OriginalActorId, p.CreatedById, p.CreatedDate from ProcessInstanceWorkitem p


For query to ProcessInstanceWorkitem, actually you can run Salesforce report All Pending Approval Requests. This is standard Salesforce report available from 'Administrative Reports' folder. 

And screenshot below for the result and compare with query result above.


Page-level ad