Pages

Friday, February 28, 2014

How to count unique Account in an Opportunity report in Salesforce ?

Requirements background:
1. User would like to know how many accounts have closed won opportunity last quarter?
2. To show all opportunity related in point (1) above in the same report.

Analysis:
1. Create Opportunities report type with Summary report.
This approach maybe work, but if you have a lot of accounts, it is not a good solution to count number of account manually


2. Create Account report with Cross Filter with Opportunity
Using this approach, we can get number of Account, but:
- No information on Opportunity in the report
- We cannot get Opportunity Closed Date as filter or criteria


Solution: use the "Power of One"
Here you go:
1. Create a formula field in Account with return type = Number

2. Use this field in the report and Sum it

As you see in above report, it is exactly the same with the first report, but we just add a field to count. So, user can easily see that we have 8 closed won opportunity for 5 accounts last quarter.

You can use the same solution for other object related to Account, from: Case, Contact, Opportunity, etc and for other master-detail or lookup relationship objects.


Wednesday, February 26, 2014

What happens when Lead is converted in Salesforce ?


1. Once a lead is converted, lead details are no longer visible from the Lead page payout. If you note the Lead ID before conversion, paste the Lead ID into the URL; it will show information about:
  • When the lead is converted
  • Account and Contact created or existing Account and Contact attached
  • Opportunity created
Unless the user has "View and Edit Converted Leads" permission in the profile or a permission set assigned.

2. The user can still access lead details from a report using report type Leads with converted lead information.

3. The lead is frozen; you cannot even update the lead record.

4. The Converted field is ticked, and the Converted Date field will be populated on the date the conversion happened.

5. Chatter feed posts associated with the lead are not migrated anywhere, and the lead posts are no longer available in the Chatter feed.

6. When you convert a lead into an existing contact, you are not automatically following the account. However, when you convert the lead into a new account, you automatically follow the new account, unless you have disabled Automatically follow records that I create in your Chatter settings.

7. If the Lead is associated with campaigns, all Campaign History is copied into the Contact created. For an opportunity, it will create Campaign Influence if fit into criteria, and one will be selected as Primary Campaign Source based on the latest campaign attached to the Lead.

8. All notes and attachments from the lead are converted and attached to the new account and contact (not to opportunity).

9. All open activities and activity history from the lead are converted and attached to the new account, contact, and opportunity.

10. If an existing Account has the same Company name as those specified on the lead, you can choose to attach to the existing Account, so this will not create a new Account. 

11. A lead with the same First and Last Name, but a different Company, with an existing Account will always be created as a new Contact

12. When a user selects to attach to an existing Account, the user will be given the option to attach to an existing Contact for the same Account only if First or Last Name is similar.

13. When you attach to an existing Account and Contact, information from the lead is inserted only into blank fields; Salesforce does not overwrite existing account and contact data. A checkbox has 2 possible values: 0 or 1, so it will never be considered a blank field, so the checkbox won't be overwritten.

14. Update Last Modified Date and Last Modified By fields on converted leads when picklist values included on converted leads are changed.

15. You can’t convert a lead that’s associated with an active approval process or has pending workflow actions.

16. By default, the Lead owner will be the record owner of the created Account, Contact, and Opportunity.

17. If you have a Record Type in Account, Contact, or Opportunity, the created record will follow the Default Record Type of the record owner as in the Profile.

18. Contact will be added in Opportunity Contact Role as Primary.

19. The Campaign Member of Lead will be linked to the converted Contact, but the LeadId value will be maintained, while LeadOrContactId will be updated to Contact ID.


Reference:



Query Date Field in Salesforce using SOQL

Looking record for Blank Date
In report, we can easily add filter date equals <blank> , leave the value empty


In validation rule or workflow rule, we can use ISBLANK() formula to check if the date field is blank, example: ISBLANK( default_date__c )

To run SOQL query for records with blank date
example: SELECT Id, Name FROM Account WHERE default_date__c = NULL


Compare with a date
example: SELECT Id, Name, default_date__c From Account WHERE default_date__c > 2014-01-15 ORDER BY default_date__c 

Note: it have to be in YYYY-MM-DD (need to be 4-2-2 characters, so 2014-1-15 will not works)


Reference:


Monday, February 24, 2014

Salesforce: Global Search Result on Custom Object

This is continuation of previous blog Salesforce Search on Custom Object and Chatter.

We have an issue in office today that some users cannot see search result from a custom object, while some other users can see the result using same keywords.

Analysis:
  • Object permission: user have read permission in profile and user able to open the record URL
  • Tab: should be not because other user able to search and result shown
Finally we get the caused, it is because the Tab Setting for that User Profile is Tab Hidden, while other user able to search have setting with Default Off.

Conclusion, "Tab Hidden" in Tab Setting for a profile has effect to search result, it is the same as the tab is never created for that Profile.



Since Winter '16 release (Oct 2015), Salesforce introduce "Allow Search" option for custom object, if this is not enabled, the object will be not included in search result.

SUMMARY: for user able to search result from a custom object, they should satisfy ALL items below:
  • Tab must be created for that custom object, user need to have visibility permission for that tab from Profile or Permission Set.
  • Allow Search must be enabled for that custom object.



Last update: 8 May 2016

Salesforce: Customize mouse Hover Lookup

This will be gonna a simple blog post. Many users like this, when user hover mouse over a lookup field, Salesforce will show some information related to the lookup record in that little popup window. So, instead of click the field, just hover it and user will not lose that page. Users can quickly view information about a record before clicking View for the record's detail page or Edit for the edit page.

The same information will be shown when user hover a record in the Recent Items list on the sidebar.





Can we modify fields show in the popup? YES, example we want to customize field in Account hover when user hover it from Contact page layout:
  1. Don't be confuse that we are not change anything in Contact Page Layout, although hover happened in Contact page
  2. Go to Account object and edit Account Page Layout assigned to particular profile and record type (if any)
  3. Click Mini Page Layout at the top of the editor
  4. Select fields you want it show when user hover over the object

Note:
  • There are field that you cannot remove, such as: object name, Parent Account for account object (to hide this, you can use Field Level Security, but of course field will be not visible anywhere, from: page layout, report, and etc)
  • There are field that always shown, example in User object, it will always show: Title, Email, Phone, Manager

Reference:


Sunday, February 23, 2014

Salesforce: Edit Locked Record

In Approval Process, when a user click "Submit for Approval" or auto submit by Process Builder, record will be locked by default. This will prevent user to edit any fields in the record from page layout, notice a pad lock icon at the left of the buttons, even when you try to update via API tool, you will get error "The Entity Is Locked For Editing".

So, is there any user able to edit the record? YES, they are:
1. User with System Administrator profile
2. User with Modify All Data permission
3. User with Modify All permission in the object of record locked
4. If the Approval Process configuration in Record Editability Properties = Administrators OR the currently assigned approver can edit records during the approval process. This will allow current approver ability to edit the record.


Note: user does not fall into any of categorization above will NOT able to edit the record, including:
  • Record owner
  • User in higher role hierarchy of record owner
  • User in higher role hierarchy of approver
  • Delegated approver of the approver


Page-level ad