Pages

Tuesday, March 29, 2016

Salesforce: Permission Change Status, Change Owner, Add to Campaign

We have case when some of our users feedback that they do not see Change Status, Change Owner, Add to Campaign button in Lead list View.



While some other users able to see that buttons.


So, what is the caused?
Change Status - to see this button, user need to have Manage Leads permission
Change Owner - to see this button, user need to have Transfer Leads permission
Add to Campaign - to see this button, user need to be Marketing User in user detail and also have Edit permission in Campaign object, this is also applicable for Contact list View.


On separate note, for custom object, user with Modify All permission for that object will see Change Owner button in the list view.




Reference:




Sunday, March 27, 2016

Salesforce: How to delete Debug Level in Salesforce?

In previous blog, we discussed about using Debug Log to troubleshoot workflow in Salesforce. A debug log records database operations, system processes, and errors that occur when executing a transaction or while running unit tests.

The system generates a debug log for a user every time that user executes a transaction and the user has a trace flag with start and expiration dates that contain the transaction's start time.

When you add user to trace for debug, you have to select an existing Debug Level or create a new Debug Level.



To add new Debug Level, click New button in Debug Level lookup window.



You can modify existing debug level by click Debug Level name, then adjust debug level for each Category.



However, over the time, you may get more and more debug levels added and may you decide to delete old levels no longer needed. Here is the steps:

1. Open Developer Console



2. Click Debug | Change Log Levels...




3. Click Add/Change under any DebugLevel Action



4. Select Debug Level you want to delete | click Remove button



5. You also can edit debug level for each Debug level




Reference:



Salesforce: using Debug Log to Troubleshoot Workflow

Workflow is the most favorite tool available for Salesforce admin for automation (before Process Builder born), even after Process Builder available, workflow still favorite by Salesforce admin because of the simplicity. However, when you have a lot of workflows in the same object, sometimes it become too complex to troubleshoot when workflow do not action as it suppose to.

One of the easiest option to troubleshoot workflow is using Debug Log, navigate to Setup | LogsDebug Logs. You need to define Traced Entity (in this case, select User), Start Date Time, Expiration Date Time, and Debug Level (choose finest).

Once a record is create or update, refresh the debug log and notice new log is added. Here are few samples with debug log detail:


1. One workflow and criteria no match
 36.0 APEX_CODE,NONE;APEX_PROFILING,NONE;CALLOUT,NONE;DB,NONE;SYSTEM,NONE;VALIDATION,NONE;VISUALFORCE,NONE;WORKFLOW,FINEST  
 06:54:11.0 (490818)|EXECUTION_STARTED  
 06:54:11.0 (532130)|CODE_UNIT_STARTED|[EXTERNAL]|Workflow:Account  
 06:54:11.0 (10666652)|WF_RULE_EVAL_BEGIN|Workflow  
 06:54:11.0 (10710163)|WF_CRITERIA_BEGIN|[Account: Ke 1 0012800000UXMjh]|Type = Prospect|01Q28000000DuoK|ON_ALL_CHANGES|0  
 06:54:11.0 (14983111)|WF_RULE_FILTER|[Account : Type equals Prospect]  
 06:54:11.0 (15020276)|WF_RULE_EVAL_VALUE|  
 06:54:11.0 (15044369)|WF_CRITERIA_END|false  
 06:54:11.0 (15062046)|WF_SPOOL_ACTION_BEGIN|Workflow  
 06:54:11.0 (15074132)|WF_ACTION| None  
 06:54:11.0 (15079771)|WF_RULE_EVAL_END  
 06:54:11.0 (15121739)|WF_ACTIONS_END| None  
 06:54:11.0 (15134839)|CODE_UNIT_FINISHED|Workflow:Account  
 06:54:11.0 (15144558)|EXECUTION_FINISHED  
Color coded:
YELLOW background: start and end of workflow
GREEN background: start and end of workflow action
LIGHT YELLOW background: range of one workflow
DARK GREEN background: list of actions
PURPLE text: record Id
BLUE text: workflow Id
RED text: workflow rule criteria match


2. One workflow and criteria match
 36.0 APEX_CODE,NONE;APEX_PROFILING,NONE;CALLOUT,NONE;DB,NONE;SYSTEM,NONE;VALIDATION,NONE;VISUALFORCE,NONE;WORKFLOW,FINEST  
 07:00:42.0 (494258)|EXECUTION_STARTED  
 07:00:42.0 (530411)|CODE_UNIT_STARTED|[EXTERNAL]|Workflow:Account  
 07:00:42.0 (17812902)|WF_RULE_EVAL_BEGIN|Workflow  
 07:00:42.0 (17921019)|WF_CRITERIA_BEGIN|[Account: Ke 1 0012800000UXMjh]|website blank|01Q28000000DuoP|ON_ALL_CHANGES|0  
 07:00:42.0 (22442943)|WF_RULE_FILTER|[Account : Website equals ]  
 07:00:42.0 (22533614)|WF_RULE_EVAL_VALUE|  
 07:00:42.0 (22559049)|WF_CRITERIA_END|true  
 07:00:42.0 (36720479)|WF_SPOOL_ACTION_BEGIN|Workflow  
 07:00:42.0 (47993268)|WF_RULE_INVOCATION|[Account: Ke 1 0012800000UXMjh]  
 07:00:42.0 (48084821)|WF_ACTION_TASK|Task:Remember|Id=01V280000000CKK|CurrentRule:website blank (Id=01Q28000000DuoP)|AssignedTo:Admin Playground|DueDate:Sun Apr 03 00:00:00 GMT 2016  
 07:00:42.0 (48374884)|WF_ACTION| Task: 1;  
 07:00:42.0 (48380808)|WF_RULE_EVAL_END  
 07:00:42.0 (263328067)|WF_ACTIONS_END| Task: 1;  
 07:00:42.0 (263343578)|CODE_UNIT_FINISHED|Workflow:Account  
 07:00:42.0 (263350475)|EXECUTION_FINISHED  
Additional color coded:
FUCHSIA text: Task action Id
ORANGE text: all actions


3. Two active workflows; only one criteria match: create task
 36.0 APEX_CODE,NONE;APEX_PROFILING,NONE;CALLOUT,NONE;DB,NONE;SYSTEM,NONE;VALIDATION,NONE;VISUALFORCE,NONE;WORKFLOW,FINEST  
 07:02:14.0 (78956)|EXECUTION_STARTED  
 07:02:14.0 (125619)|CODE_UNIT_STARTED|[EXTERNAL]|Workflow:Account  
 07:02:14.0 (24545463)|WF_RULE_EVAL_BEGIN|Workflow  
 07:02:14.0 (24621836)|WF_CRITERIA_BEGIN|[Account: Ke 1 0012800000UXMjh]|Type = Prospect|01Q28000000DuoK|ON_ALL_CHANGES|0  
 07:02:14.0 (30423437)|WF_RULE_FILTER|[Account : Type equals Prospect]  
 07:02:14.0 (30448452)|WF_RULE_EVAL_VALUE|  
 07:02:14.0 (30456367)|WF_CRITERIA_END|false  
 07:02:14.0 (30476927)|WF_CRITERIA_BEGIN|[Account: Ke 1 0012800000UXMjh]|website blank|01Q28000000DuoP|ON_ALL_CHANGES|0  
 07:02:14.0 (30511143)|WF_RULE_FILTER|[Account : Website equals ]  
 07:02:14.0 (30524283)|WF_RULE_EVAL_VALUE|  
 07:02:14.0 (30529957)|WF_CRITERIA_END|true  
 07:02:14.0 (47469103)|WF_SPOOL_ACTION_BEGIN|Workflow  
 07:02:14.0 (50377861)|WF_RULE_INVOCATION|[Account: Ke 1 0012800000UXMjh]  
 07:02:14.0 (50473276)|WF_ACTION_TASK|Task:Remember|Id=01V280000000CKK|CurrentRule:website blank (Id=01Q28000000DuoP)|AssignedTo:Admin Playground|DueDate:Sun Apr 03 00:00:00 GMT 2016  
 07:02:14.0 (50502200)|WF_ACTION| Task: 1;  
 07:02:14.0 (50508567)|WF_RULE_EVAL_END  
 07:02:14.0 (102090292)|WF_ACTIONS_END| Task: 1;  
 07:02:14.0 (102112660)|CODE_UNIT_FINISHED|Workflow:Account  
 07:02:14.0 (102122130)|EXECUTION_FINISHED  
Additional color coded:
GREEN text: second workflow
LIGHT BLUE background: second range workflow
DARK GREEN background: Create Task action


4. Two active workflows; both criteria match: create task & field update
 36.0 APEX_CODE,NONE;APEX_PROFILING,NONE;CALLOUT,NONE;DB,NONE;SYSTEM,NONE;VALIDATION,NONE;VISUALFORCE,NONE;WORKFLOW,FINEST  
 07:06:23.0 (571061)|EXECUTION_STARTED  
 07:06:23.0 (614080)|CODE_UNIT_STARTED|[EXTERNAL]|Workflow:Account  
 07:06:23.0 (13270473)|WF_RULE_EVAL_BEGIN|Workflow  
 07:06:23.0 (13555244)|WF_CRITERIA_BEGIN|[Account: Ke 1 0012800000UXMjh]|Type = Prospect|01Q28000000DuoK|ON_ALL_CHANGES|0  
 07:06:23.0 (17599518)|WF_RULE_FILTER|[Account : Type equals Prospect]  
 07:06:23.0 (17747778)|WF_RULE_EVAL_VALUE|Prospect  
 07:06:23.0 (17833551)|WF_CRITERIA_END|true  
 07:06:23.0 (18589437)|WF_CRITERIA_BEGIN|[Account: Ke 1 0012800000UXMjh]|website blank|01Q28000000DuoP|ON_ALL_CHANGES|0  
 07:06:23.0 (18681542)|WF_RULE_FILTER|[Account : Website equals ]  
 07:06:23.0 (18760950)|WF_RULE_EVAL_VALUE|  
 07:06:23.0 (18767696)|WF_CRITERIA_END|true  
 07:06:23.0 (18860608)|WF_SPOOL_ACTION_BEGIN|Workflow  
 07:06:23.0 (19151790)|WF_FIELD_UPDATE|[Account: Ke 1 0012800000UXMjh]|Field:Account: Description|Value:2016-03-26 23:06:23Z|Id=04Y280000009Poy|CurrentRule:Type = Prospect (Id=01Q28000000DuoK)  
 07:06:23.0 (21694421)|WF_RULE_INVOCATION|[Account: Ke 1 0012800000UXMjh]  
 07:06:23.0 (21797283)|WF_ACTION_TASK|Task:Remember|Id=01V280000000CKK|CurrentRule:website blank (Id=01Q28000000DuoP)|AssignedTo:Admin Playground|DueDate:Sun Apr 03 00:00:00 GMT 2016  
 07:06:23.0 (21879044)|WF_ACTION| Field Update: 1; Task: 1;  
 07:06:23.0 (21929815)|WF_RULE_EVAL_END  
 07:06:23.0 (75368022)|WF_ACTIONS_END| Field Update: 1; Task: 1;  
 07:06:23.0 (75384504)|CODE_UNIT_FINISHED|Workflow:Account  
 07:06:23.0 (75390586)|EXECUTION_FINISHED  
Additional color coded:
LIGHT PINK background: Field Update action

Lesson learn from this scenario:




5. One active workflows - no criteria match; one inactive workflow
 36.0 APEX_CODE,NONE;APEX_PROFILING,NONE;CALLOUT,NONE;DB,NONE;SYSTEM,NONE;VALIDATION,NONE;VISUALFORCE,NONE;WORKFLOW,FINEST  
 07:12:20.0 (607207)|EXECUTION_STARTED  
 07:12:20.0 (677793)|CODE_UNIT_STARTED|[EXTERNAL]|Workflow:Account  
 07:12:20.0 (21667072)|WF_RULE_EVAL_BEGIN|Workflow  
 07:12:20.0 (22135772)|WF_CRITERIA_BEGIN|[Account: Ke 1 0012800000UXMjh]|website blank|01Q28000000DuoP|ON_ALL_CHANGES|0  
 07:12:20.0 (29783091)|WF_RULE_FILTER|[Account : Website equals ]  
 07:12:20.0 (29880114)|WF_RULE_EVAL_VALUE|www.aa.com  
 07:12:20.0 (29973169)|WF_CRITERIA_END|false  
 07:12:20.0 (30005156)|WF_SPOOL_ACTION_BEGIN|Workflow  
 07:12:20.0 (30068782)|WF_ACTION| None  
 07:12:20.0 (30120461)|WF_RULE_EVAL_END  
 07:12:20.0 (30246879)|WF_ACTIONS_END| None  
 07:12:20.0 (30260963)|CODE_UNIT_FINISHED|Workflow:Account  
 07:12:20.0 (30268055)|EXECUTION_FINISHED  

Lesson learn from this scenario: inactive workflow will not be evaluated at all.


6. Three
 active workflows; all criteria match: create task & field update & send email
 36.0 APEX_CODE,NONE;APEX_PROFILING,NONE;CALLOUT,NONE;DB,NONE;SYSTEM,NONE;VALIDATION,NONE;VISUALFORCE,NONE;WORKFLOW,FINEST  
 07:14:30.0 (98803)|EXECUTION_STARTED  
 07:14:30.0 (154441)|CODE_UNIT_STARTED|[EXTERNAL]|Workflow:Account  
 07:14:30.0 (16424626)|WF_RULE_EVAL_BEGIN|Workflow  
 07:14:30.0 (16495118)|WF_CRITERIA_BEGIN|[Account: Ke 1 0012800000UXMjh]|Type = Prospect|01Q28000000DuoK|ON_ALL_CHANGES|0  
 07:14:30.0 (20462863)|WF_RULE_FILTER|[Account : Type equals Prospect]  
 07:14:30.0 (20571360)|WF_RULE_EVAL_VALUE|Prospect  
 07:14:30.0 (20597483)|WF_CRITERIA_END|true  
 07:14:30.0 (36578619)|WF_CRITERIA_BEGIN|[Account: Ke 1 0012800000UXMjh]|website blank|01Q28000000DuoP|ON_ALL_CHANGES|0  
 07:14:30.0 (36681809)|WF_RULE_FILTER|[Account : Website equals ]  
 07:14:30.0 (36795290)|WF_RULE_EVAL_VALUE|  
 07:14:30.0 (36803418)|WF_CRITERIA_END|true  
 07:14:30.0 (36830368)|WF_CRITERIA_BEGIN|[Account: Ke 1 0012800000UXMjh]|Billing Country is Singapore|01Q28000000DuoU|ON_ALL_CHANGES|0  
 07:14:30.0 (36928167)|WF_RULE_FILTER|[Account : Billing Country equals Singapore]  
 07:14:30.0 (36951420)|WF_RULE_EVAL_VALUE|Singapore  
 07:14:30.0 (36955780)|WF_CRITERIA_END|true  
 07:14:30.0 (37008104)|WF_SPOOL_ACTION_BEGIN|Workflow  
 07:14:30.0 (37341627)|WF_FIELD_UPDATE|[Account: Ke 1 0012800000UXMjh]|Field:Account: Description|Value:2016-03-26 23:14:30Z|Id=04Y280000009Poy|CurrentRule:Type = Prospect (Id=01Q28000000DuoK)  
 07:14:30.0 (50320374)|WF_RULE_INVOCATION|[Account: Ke 1 0012800000UXMjh]  
 07:14:30.0 (50413236)|WF_ACTION_TASK|Task:Remember|Id=01V280000000CKK|CurrentRule:website blank (Id=01Q28000000DuoP)|AssignedTo:Admin Playground|DueDate:Sun Apr 03 00:00:00 GMT 2016  
 07:14:30.0 (50441107)|WF_RULE_INVOCATION|[Account: Ke 1 0012800000UXMjh]  
 07:14:30.0 (50459270)|WF_EMAIL_ALERT|Id=01W28000000CylZ|CurrentRule:Billing Country is Singapore (Id=01Q28000000DuoU)  
 07:14:30.0 (136184167)|WF_EMAIL_SENT|Template:00X28000001CeTV|Recipients:yujohan@gmail.com |CcEmails:  
 07:14:30.0 (136249507)|WF_ACTION| Field Update: 1; Task: 1; Email Alert: 1;  
 07:14:30.0 (136265700)|WF_RULE_EVAL_END  
 07:14:30.0 (195583761)|WF_ACTIONS_END| Field Update: 1; Task: 1; Email Alert: 1;  
 07:14:30.0 (195602601)|CODE_UNIT_FINISHED|Workflow:Account  
 07:14:30.0 (195609979)|EXECUTION_FINISHED  
Color coded:
BLACK bold text: Record Id
RED text: 1st workflow Id
BLUE text: 2nd workflow Id
FUCHSIA textL 3rd workflow Id
YELLOW background: 1st workflow action
GREEN background: 2nd workflow action
BLUE background: 3rd workflow action
GREEN background text: Field Update Id
CYAN background text: Email Alert Id
YELLOW background text: Email Alert Id


7. Workflow with formula evaluates to true
 36.0 APEX_CODE,NONE;APEX_PROFILING,NONE;CALLOUT,NONE;DB,NONE;SYSTEM,NONE;VALIDATION,NONE;VISUALFORCE,NONE;WORKFLOW,FINEST  
 09:57:09.0 (539007)|EXECUTION_STARTED  
 09:57:09.0 (578864)|CODE_UNIT_STARTED|[EXTERNAL]|Workflow:Account  
 09:57:09.0 (23452602)|WF_RULE_EVAL_BEGIN|Workflow  
 09:57:09.0 (23564561)|WF_CRITERIA_BEGIN|[Account: Ke 1 0012800000UXMjh]|Type = Prospect|01Q28000000DuoK|ON_ALL_CHANGES|0  
 09:57:09.0 (39215585)|WF_RULE_FILTER|[Account : Type equals Prospect]  
 09:57:09.0 (39316655)|WF_RULE_EVAL_VALUE|Prospect  
 09:57:09.0 (39344976)|WF_CRITERIA_END|true  
 09:57:09.0 (58619174)|WF_CRITERIA_BEGIN|[Account: Ke 1 0012800000UXMjh]|website blank formula|01Q28000000Duoj|ON_ALL_CHANGES|0  
 09:57:09.0 (59063797)|WF_FORMULA|Formula:ENCODED:[treatNullAsNull]ISBLANK({!ID:Website})|Values:Website=null  
 09:57:09.0 (59074730)|WF_CRITERIA_END|true  
 09:57:09.0 (59108389)|WF_CRITERIA_BEGIN|[Account: Ke 1 0012800000UXMjh]|Billing Country is Singapore|01Q28000000DuoU|ON_ALL_CHANGES|0  
 09:57:09.0 (59218244)|WF_RULE_FILTER|[Account : Billing Country equals Singapore]  
 09:57:09.0 (59255080)|WF_RULE_EVAL_VALUE|Singapore  
 09:57:09.0 (59260781)|WF_CRITERIA_END|true  
 09:57:09.0 (59301987)|WF_SPOOL_ACTION_BEGIN|Workflow  
 09:57:09.0 (59648416)|WF_FIELD_UPDATE|[Account: Ke 1 0012800000UXMjh]|Field:Account: Description|Value:2016-03-27 01:57:09Z|Id=04Y280000009Poy|CurrentRule:Type = Prospect (Id=01Q28000000DuoK)  
 09:57:09.0 (77261802)|WF_RULE_INVOCATION|[Account: Ke 1 0012800000UXMjh]  
 09:57:09.0 (77377441)|WF_ACTION_TASK|Task:Remember|Id=01V280000000CKK|CurrentRule:website blank formula (Id=01Q28000000Duoj)|AssignedTo:Admin Playground|DueDate:Sun Apr 03 00:00:00 GMT 2016  
 09:57:09.0 (77440859)|WF_RULE_INVOCATION|[Account: Ke 1 0012800000UXMjh]  
 09:57:09.0 (77461684)|WF_EMAIL_ALERT|Id=01W28000000CylZ|CurrentRule:Billing Country is Singapore (Id=01Q28000000DuoU)  
 09:57:09.0 (146795599)|WF_EMAIL_SENT|Template:00X28000001CeTV|Recipients:yujohan@gmail.com |CcEmails:  
 09:57:09.0 (146993665)|WF_ACTION| Field Update: 1; Task: 1; Email Alert: 1;  
 09:57:09.0 (147007835)|WF_RULE_EVAL_END  
 09:57:09.0 (212561460)|WF_ACTIONS_END| Field Update: 1; Task: 1; Email Alert: 1;  
 09:57:09.0 (212578852)|CODE_UNIT_FINISHED|Workflow:Account  
 09:57:09.0 (212586074)|EXECUTION_FINISHED  

All above samples before (7), we use criteria are met in the workflow rule criteria, but in (7), we use formula evaluates to true - note the difference in highlighted debug log above.



Reference:




Friday, March 18, 2016

Salesforce: My Account Teams List View

In the previous blog, we discussed options on the Account Team and Opportunity Team when generating reports. The other option for users to know if they are part of the Account Team or Opportunity Team is from List View.

In a custom list view, you can filter account lists by the account teams in which you are a member.
When creating or editing a custom list view for accounts, select the My Account Teams filter, the same in Opportunity List view you can filter by owner My Opportunity Teams.


My Account Teams :
  • I am a member of the Account Team, no matter who is the Account owner.
  • This will not include of my subordinates who is member of Account Team

My Opportunity Teams:
  • I am a member of the Opportunity Team, no matter who is the Opportunity owner.
  • This will not include of my subordinates who is member of Opportunity Team


Monday, March 7, 2016

Salesforce: Role Hierarchy versus Manager

In Salesforce, we can define Role Hierarchy and Manager for a user. In many cases, Manager is the same user with the user defined one role above on the Role Hierarchy. But, it does not always have to follow Role Hierarchy.

Manager can be someone from other role hierarchy. The most important, out of the box - there is NO direct relationship between Manager with Role Hierarchy, so do not expect when you change role hierarchy of a user, the Manager will be auto changed.

Role Hierarchy
Salesforce offers user role hierarchy that can be use for sharing settings. This is to determine the levels of access that users have in Salesforce. This define user permission to access a record, usually user in higher role hierarchy have the ability to read, update and change record owner of records owned by users below the role hierarchy.

Role hierarchy also determine report generated when user run report configured for My team. Dynamic Dashboard would be the other usage of role hierarchy, user only able to user in below role hierarchy as running user.

Manager
This field is especially useful for approval processes workflow.


There are 2 validation rules defined by Salesforce when you set a user Manager:

1. Cannot report to itself (the same user)
Error message: A user can't be his or her own manager

2. Cannot be a user that report directly to that user
example: A report to B, so B cannot report to A.
OR user report to other user in child record,
example: A report to B, B report to C, so C cannot report to A.
Error message: You cannot set a hierarchy field to point to itself or a child record




Side Note: the same logic applied when you set parent and child Accounts.



Reference:



Friday, March 4, 2016

Salesforce: Opportunity Team Report

Previous blog discussed about reports related to Account Team, this blog is the continuation discussed on Opportunity Team.

If your company practice team selling, you can enable Opportunity Team in Salesforce from Setup | Customize | OpportunitiesOpportunity TeamsOpportunity Team Settings, then select Enable Team Selling.

When running an opportunities report, you have several choices in the standard filter area that allow you to choose what types of records should be searched. Once Opportunity Team Selling feature enabled, you will have additional options when running Opportunity report.

This is options available before enable Team Selling

This is options available after enable Team Selling


The list below identifies what each choice means and how it affects the scope of your report data:

My opportunities:
ONLY the opportunities you OWNED.

My team-selling opportunities:
ONLY the opportunities where you are on the SALES TEAM.

My team-selling and my own opportunities:
Opportunities OWNED by you & opportunities where you are on the SALES TEAM.

My team's opportunities:
Opportunities OWNED by you & users who report to you in the role hierarchy.

My team's team-selling and their opportunities:
Opportunities OWNED by youusers that report to you in the role hierarchy, ALSO opportunities where you & users who report to you in the role hierarchy are on the SALES TEAM.

All opportunities:
ALL opportunities visible by the user who run the report.


Note: When Opportunity Split enabled, opportunity owner will be automatically added into Opportunity Team with role = Opportunity Owner, read this blog.


ReferenceOpportunity Reports: Opportunity Team Selling



Page-level ad