Clicks vs code df14pptx
-
Upload
christopher-lewis -
Category
Software
-
view
70 -
download
1
description
Transcript of Clicks vs code df14pptx
Clicks Vs. CodeAn Interactive Debate
Christopher Alun Lewis
Force.com MVP
@ChrisAlunLewis
Simon Lawrence
Force.com MVP
@srlawr
Welcome to Clicks Vs. Code
There are two main ways to get things done on Salesforce
• Rarely black and white as to which provides the best solution
• This session will make you think about your options in different scenarios
Welcome to Clicks Vs. Code
• We will present three requirement scenarios
• We will then present a clicks solution, and a code solution
• YOU will then vote which you would implement
• Get involved!
Scenario 1
Copy and process field data across a relationship
When an invoice line custom object is created, we need to:
• Copy the price field from a parent product object
• Copy the tax rate field from a custom setting
• Create a task to manually check stock when QTY > 100
Case for Clicks
Create a workflow rule on line item object creation and field updates to copy the price and tax.
Case for Clicks
Create a workflow rule on line item object creation and field updates to copy the price and tax.
Case for Clicks
Another workflow rule, checks Quantity amount and creates a task if needed
Case for Clicks
Another workflow rule, checks Quantity amount and creates a task if needed
Case for Clicks
Benefits:• Simple to setup• Can be updated and altered on live• Responds to data model changes automatically
Drawbacks:• No requirement to test the calculations and vulnerable to interference• Very limited customization of the Task• Difficult to see the order of execution
Building with Code
• Write test class and cover core scenarios
• Create a trigger on Creation of an Invoice Line
• Noting bulkification, load the relevant product details and copy into the Invoice Line records
• Create detailed task records for > 100 Quantity cases
Building with Code
Building with Code
Benefits:• All the logic is in one, concise place• Complete flexibility in field and data access/usage• Can create dynamic Task owner, subject and description• Requires test coverage which enforces functionality
Drawbacks:• Has to be promoted via changesets if updated• Requires manual maintenance if data model changes• Will take longer to develop, test and promote
Scenario 1 voting
So where do you stand?
ClicksCode
Scenario 2
Summarize Opportunity data on Accounts
On the Account page we would like to see:
• The total value of all related Opportunities
• The closed won ratio of related Opportunities
• The Average value of related Opportunities
Case for Clicks
Use roll up summary fields to obtain:
• The related Opportunity count
• Won Opportunity count
• The related Opportunity total value
Case for Clicks
Use roll up summary fields to obtain:
• The related Opportunity count
• Won Opportunity count
• The related Opportunity total value
Case for Clicks
Use roll up summary fields to obtain:
• The related Opportunity count
• Won Opportunity count
• The related Opportunity total value
Case for Clicks
Use formula fields to calculate:
• The Closed Won ratio
• The Average Value amount
Case for Clicks
Benefits:• Simple to setup / five fields to completion• We can adapt the method to do more complex calculations quickly
Drawbacks:• Roll up summaries are limited, only 10 per object• This method only works for objects that have master detail relationships • Roll up summaries don’t work on formula fields
Building with Code
Create 3 new fields on the Account object:
• Total Opportunity amount• Closed Won Ratio • Average Opportunity amount
Building with Code
• Write test methods
• Write a new trigger on Opportunity to update related Account totals when an Opportunity is created, updated, deleted or undeleted
Building with Code
Building with Code
Building with Code
Benefits:• Excellent reusability… adopt a pattern and the same code can be used many times for many different object relationships
• Calculations can be much more complex, involving several related objects• Can traverse Lookup relationships and summarise Formulae• Test methods can be used to verify results
Drawbacks:• Writing code and related test methods is time consuming• Less adaptable in production
Scenario 2 voting
So where do you stand?
ClicksCode
Scenario 3
Graphical customer relationship view
We want to view our entire relationship with a customer • The pipeline of all related Opportunities
• The number and status of all related Cases
• A history of recent Activities
Case for Clicks
Simple… Reports and Dashboards!
Create a collection of base reports
• Opportunities
• Cases
• Activities with Accounts
Case for Clicks
Create an Accounts Data dashboard leveraging the reports to show all Account data
Case for Clicks
Use a Dashboard filter to allow the user to select which Account they want to view data for:
Case for Clicks
Benefits:• Simple and quick to create (3 Reports + 1 Dashboard)• Can be customised to individual users requirements (specific Account views)• Clicking on the charts actually drills down into data report
Drawbacks:• A maximum of 30 filters can be used per dashboard• A manual filter needs to be created for each Account• Load times between selections is fairly slow (20-30 seconds)
Building with Code
Custom Visualforce Page with Account selector:• Leverages Apex:Chart Component tags• Account combo box dynamically populated through Apex• Upon selection, automatically refreshes page
Building with Code
OR Custom Visualforce on the Account Page:
• Use a controller extension to get Account/Children details
• Build Account charts based on retrieved data
• Place Visualforce page on Standard Account Page
Building with Code
As simple as a section of Visualforce code
Building with Code
And a controller extension to marshall the data about
Building with Code
Benefits:• No limitations on how many different Accounts you can view.• Fast screen refresh rates.• Ability to create actions based on chart results.
Drawbacks:• Time consuming to build.• Difficult to schedule content in an email.• Can’t easily drill down into reports data.
Scenario 3 voting
So where do you stand?
ClicksCode
The Wrap up
There is no “right answer” when it comes to clicks vs. code.
Attribute Clicks Code
Time to develop Short Long
Flexibility Some Lots
Limitations Restricted by platform Governor Limits
Adaptability Some Great
Any questions?
Christopher Alun Lewis
Force.com MVP
@ChrisAlunLewis
Simon Lawrence
Force.com MVP
@srlawr