Sunday, August 30, 2015

Salesforce: Approval Process - How to approve ?

In previous blog, we discussed about who can approve in approval process? Next, we would like to discuss on how to Approve?

In the approval process, when user submit for approval, system will send an email to approver using email template defined in Approval Assignment Email Template, but this template is not mandatory, so when no template defined, system will use default template with a link to Approval Page Layout page in system.

When using custom email template for approval submission, use following merge field to bring approver directly to the approval page layout: {!ApprovalRequest.Internal_URL} 

Sample email template:
Dear Sir or Madam,

{!User.Full_Name__c} ({!ApprovalRequest.Process_Assignee}) has requested your approval for expense with amount: {!NullValue(Expense__c.Amount__c, "0")}
Expense detail: {!Expense__c.Link}
Expense status: {!ApprovalRequest.Status}

Please click this link to approve or reject {!ApprovalRequest.Internal_URL}


** notice the usage of formula {!NullValue(field name, string)} 

There are few ways for approver to approve or reject the approval process request:

1. Record page layout - Approval History 
Scroll down to Approval History related list of the record page layout, just make sure Approval History is added to the page layout. All users (with access to the record) will see the approval history here, from when and who submit for approval, when and who approve, how many level of approval and reassign history.

2. Home page - Items to Approve
Home page is the landing page when user login to Salesforce, so it is good idea to add Items to Approve component in the Home Page Layout. Only items need to approve by that user will show in user home page. User can approve or reject from here, or by click a link to open record detail. It also show who and when submit for approval.

3. Chatter page
To enable approval process in Chatter, navigate to Setup | Customize | Chatter | Settings, looks for Allow Approvals and enable it. Once enabled, all approval process will be available in Chatter.

If the approver have Salesforce1 mobile app, he/she will see the approval request as notification in the Salesforce1 app. Click the notification will allow user to approve or reject from the mobile.

4. Email
When enabling email approval, system will lets users to reply to email approval requests by typing APPROVE or REJECT in the first line and adding comments in the second line.

To enable approval from email, navigate to Setup | CreateWorkflow & Approvals | Settings, look for Enable Email Approval Response and enable it.

If there is no template assigned to 'Approval Assignment Email Template', and approval via Chatter is enabled, screenshot below taken from email received by approver, where user can use acceptable words: APPROVE, APPROVED, YES, REJECT, REJECTED, NO - not case sensitive, to approve or reject.

Salesforce: Adding Product to Opportunity Layout

Product is nothing new in Salesforce, it has been available in Salesforce for long long time, although there is no enhancements in last couple of release (except adding into Salesforce1 app), but it still widely used in new Salesforce implementation. Product is a special object, from layout and relation to other objects, and etc.

To add Products to Opportunity, scroll down to the Opportunity Lines related list in Opportunity page layout. At the same area, user able to choose a Price Book:
  • Product availability and List Price is based on Price Book selected 
  • Only 1 price book for each Opportunity, changing Price Book in an Opportunity will delete all existing Opportunity Lines
  • If you have multi-currencies enabled, available products will be based on Opportunity currency and Products added to the Price Book for that currency. 
This would be a simple blog to explain how to configure layout related to Product.

1. Opportunity Line Selection
When user click Add Opportunity Line button, a special page 'Opportunity Line Selection' showing available products related to the selected Price Book and Opportunity currency, where user also can search by keyword to limit products shown.

We cannot configure search functionality at upper part of this screen, but we can configure columns show for the Products at lower part.

Navigate to Setup | Customize | Opportunities Opportunity Products | Search Layouts. There will be only 1 layout here, changes made to it will affect all product search layouts. However, Product Name cannot be removed and must be the first field in the layout. 

2. Add Opportunity Line
User click checkboxes next to the product in screenshot above to select the product, then click Select button, system will bring you to 'Add Opportunity Line' page. All selected products in previous screen will be shown here, where user need to enter additional information for each product line. We can customize columns and make it as mandatory fields.

To customize columns shown in Add Opportunity Line, navigate to Setup | Customize | Opportunities | Opportunity Products | Page Layouts | Edit Multi-Line Layout. Fields available in Edit Multi-Line Layout is based on field added into Opportunity Product Page Layout, this mean you will not see the field in Multi-Line layout if that field is not added into Opportunity Product Page Layout. The same for mandatory fields, if the field is set as mandatory in Opportunity Product Page Layout, it will be mandatory as well in Edit Multi-Line Layout.

The same layout will be used when user click Edit All button in Opportunity Lines related list.

By default, Sales Price and Quantity is mandatory fields and cannot be removed from page layout, but if your organization do not use quantity, example: for company selling Service instead of Product, you can reach Salesforce support to request to make it as not mandatory in page layout, see this article How can I make Sales Price or Quantity 'optional' on an Opportunity line item?

As admin, you can lock the Sales Price to read-only for users, so Sales Price will always the same with List Price defined in the Price Book, but users still can give Discount (if the field added to the layout). To configure this, navigate to user Profile and disable Edit Opportunity Product Sales Price permission in General User Permissions section.


Saturday, August 29, 2015

Salesforce: Track converted Account or Opportunity from Lead

When a Lead in converted into Account, Contact and Opportunity in Salesforce, you can easily track what is the Account and Contact created (or attach to existing Account and Contact), included Opportunity created (if any). By opening the converted Lead in Salesforce, it will show you the Account, Contact and Opportunity name and link, although you will no longer see the Lead detail, except using "Leads with converted information" report.

But, looking from Account, Contact and Opportunity perspective, it is not easy to identify which of them are converted from Lead. However, if you have field history tracking enabled, looking at the object history related list will tell you if the record is created by Lead conversion or not.

Account History

Opportunity Field History

This will be not ideal if you would like to run a report of Account or Opportunity with Lead conversion information, because that information relationship only available in report with type Leads with converted lead information.

Workaround: we can built a simple solution (without code), in this scenario, we would like to report if the Opportunity is created from Lead conversion, and if yes, from which Lead.

1. Create Custom Text Field at Opportunity
Create a custom text field in Opportunity, and make sure with 15 or more characters length.

2. Create a Custom Formula Field at Lead
This formula will return in Text format. The formula would be just a simple Id that will return 15 characters length of the Lead Id, or CASESAFEID(id) to return 18 characters length of the Lead Id.

3. Map Lead Field
From Lead field setup, map custom formula field at Lead to custom text field at Opportunity, this is fields we just created above.

4. Done
Pretty easy, isn't it? From now on, we will be able to tell by running an opportunity report, if the Lead Id is not blank, the Opportunity is created from Lead conversion, otherwise it is not created from Lead conversion.

How to handle if user Clone the Opportunity?
A classic issue that we thought that the Lead Id will be bring over to the new Opportunity cloned, so the Lead Id information is no longer correct. This is only true if we add Lead Id custom text field in to Opportunity page layout.

This mean, Clone function will only clone fields that show in the page layout. By remove that field in the page layout, it will not clone Lead Id. See sample below:

As a double protection to make sure the Lead Id will never be cloned to the new opportunity:
1. Set the text field in Opportunity to 18 characters (for case insensitive Id)
2. Set the text field in Opportunity as Unique and not Case Sensitive
3. Set the formula field in Lead to CASESAFEID(id)

This will protect if in the future, someone build a custom clone functionality, system will throw error by not allowing duplicate Lead Id in Opportunity.

Monday, August 24, 2015

Salesforce: Lookup Options in Lookup Relationship

When you create a lookup relationship from child to parent, there are a few option you can configure.

What to do if the lookup record is deleted?
1. Clear the value of this field
This would be the default option. Relationship between parent and child would be very loose. You can delete the parent or child without affected each other.

2. Don't allow deletion of the lookup record that's part of a lookup relationship
This option will not allow user to delete parent record when it have child records. But, deleting child record will have no issue.

Screenshot below show how the system will response upon deletion of parent with child record.
4 ke 1 is parent record ; 5 ke 1 is child record ; 5th level invoices is child object

There is also an option for Required - Always require a value in this field in order to save a record. By selecting this option, every child need to have a parent record upon record creation or update. This also mean, not allowing parent record deletion if it has child. Therefore, once this option is selected, only option (2) above Don't allow deletion of the lookup record that's part of a lookup relationship will be available.

If you have requirement to delete all child records once parent record is deleted, this is not covered in any of above scenarios using out of the box feature in Lookup relationship. One of the option is to change the relationship from Lookup to Master-Detail relationship.

Salesforce: Product in Multi Currencies Setup

In previous blog, we discussed on how to setup multi currencies. You defined the corporate currency, adding a few currencies needed for your new branch office in overseas, configure the exchange rate, make sure each user have correct default currency and option to select currency in the page layout. As admin, you also update pipeline reports with additional converted fields. All looking good and you think ready for deployment.

As the good admin, you have to configure this in a sandbox and get your users to have a UAT sign-off before deploy into Production environment. But, your users found that they cannot add Product if the Opportunity is not in the corporate currency. When they click "Add Product" button, there is no products shown in the Product Selection search page.

What is the issue? 
This is because you need to add the products with all new currencies for all Price Books needed.

This is a 2 steps process. You will need to ensure that you have the currency in Standard Pricebook before adding them into any Custom Pricebook.

1st step is to add in the Standard Pricebook 
Even you not use Standard Pricebook, meaning Standard Pricebook is not Active. You have to add new currencies for the Products in this Pricebook.

But, if you have 100 products and 5 price books, this process will be very tedious if have to set it manually. Fortunately, we can use Data Loader to load them.

Here is the data needed to populate for Standard Pricebook:
Object: PriceBookEntry
- CurrencyIsoCode
- Pricebook2Id
- Product2Id
- UnitPrice

If you notice, there is a field called IsActive in PriceBookEntry, but since if we are not using Standard Pricebook, we can skip that field, so when the price book created, it will show as Inactive product for the Standard Pricebook. But, if you are using Standard pricebook, you need to populate IsActive = 1.

While for UnitPrice, it is a mandatory field, even you not use it, you can just populate 1 or 0 for this field.

CurrencyIsoCode is all new currencies added to the system.

Pricebook2Id is the Pricebook Id, this would be standard price book, the Id is start with prefix 01s

Product2Id is the Product Id, this Id is start with prefix 01t

CurrencyIsoCode, Pricebook2Id, and Product2Id must be unique across PriceBookEntry object.

Each successful record inserted to the Pricebook Enrty object will have a record with prefix 01u.

2nd step is to add to Custom Pricebooks (optional)
If you have Custom Pricebook, this would be the 2nd step after you load all the products with the currencies to Standard Pricebook as in step 1 above.

The same thing here, we can use Data Loader to load them, and again we need to load them into the same PriceBookEntry object. You need to load the same data set, except it would be custom Price Book Id and make sure IsActive = 1.
Object: PriceBookEntry
- CurrencyIsoCode
- Pricebook2Id
- Product2Id
- UnitPrice
- IsActive

What happened if I skip step 1 and directly go to step 2? You will get error "No Standard Price Defined For This Product"


Saturday, August 22, 2015

Salesforce: Multi Currencies Setup

So your company is expanding to multiple countries, good that company is growing. Since Salesforce is your company CRM tool, it is a cloud based application and accessible from anywhere with internet connection. Branch setup in new countries should have no issue to use Salesforce.

Wait a minute, other countries mean that your sales rep will sell in different currencies. It would be ideal that the pipeline should use the original currency, and head quarter able to report in the corporate currency with conversion rate defined.

Great news that Salesforce support multi currencies out of the box. You can defined many currencies as needed, setup corporate currency, conversion rate (including dated exchange rate), show converted currency in the reporting and in the pipeline detail.

Here a few steps to enable multi currencies:

1. Activate
Navigate to SetupCompany ProfileCompany Information, check on Allow Support to Activate Multiple Currencies. Then, contact Salesforce Support to enable multi currencies for your organization.

2. Add Currency
Navigate to Setup | Company Profile | Manage Currencies, you should see this menu only after multi currencies is enabled for your organization.

3. Dated Exchange Rate (Optional)
This will allow you to manage dated exchange rates that map a currency conversion rate to a specific date range, there are a few app in AppExchange that support integration with real time currency rate.

Once you have setup for multi currencies done in your organization, you will notice following changes:
  • Currency field in User Detail, this would be default currency for that user when create new record.
  • Currency field in each object - (standard and custom), although as system admin can hide them from the page layout.
  • In the reporting, for each currency field, there will be additional field for the converted value.
  • In the reporting, ability to summarize and Show in the selected currency for that particular report.
  • In page layout (for both standard and custom object), if the record currency is not the same with user default currency, there will be converted currency value for currency fields.


Wednesday, August 5, 2015

Setting up Passcode in Salesforce1 mobile app

If your organization is using Salesforce1 app, as admin, you can enable additional security layer when user access Salesforce1 app. Salesforce1 app offer Passcode capability for iOS and Android devices, where user have to enter passcode when open the app or idle for 1 to 30 minutes.

Once this is configured, user will be asked to enter and verify their own PIN when open the app for the first time, the length can be 4 to 8 digits.

How to setup Passcode?
  1. Go to SetupManage AppsConnected Apps
  2. Click Edit link for Salesforce1 for Android and Salesforce1 for iOS
  3. Look for Mobile Integration and set Require PIN after and Pin Length

Require PIN after specifies how much time can pass while the app is idle before the app locks itself and requires the PIN before continuing. Allowable values are none (no locking), 1, 5, 10, and 30 minutes. This policy is only enforced if a corresponding Pin Length is configured. 

Pin Length sets the length of the identification number sent for authentication confirmation. The length can be from 4 to 8 digits, inclusive.