Blog: Salesforce #DataTipOfTheDay, Tips & Tricks, and Whatever Else

When does Salesforce automatically create a Campaign Influence record?

posted Mar 23, 2017, 10:31 AM by Ezra Kenigsberg   [ updated Mar 23, 2017, 10:33 AM ]

Q: "When does Salesforce auto-create a Campaign Influence record?"

A: Salesforce automatically creates a Campaign Influence record--an association between an Opportunity with a Campaign--under these conditions.*
  1. Auto-Association must be active;
  2. a Contact is assigned an Opportunity Contact Role prior to the Opportunity's Close Date; and
  3. that same Contact is associated to a Campaign (as a Campaign Member).

* I'm not gonna get into Custom Campaign Influence Models here.

Accessing Campaign Influence records via API

posted Mar 22, 2017, 1:38 PM by Ezra Kenigsberg   [ updated Mar 23, 2017, 10:03 AM ]

Q: "How do I access Campaign Influence records via the API?"

A: Gotta carry out four steps:
  1. Turn on Customizable Campaign Influence.
  2. Assign user(s) the "CRM User" or "Sales Cloud" Permission Set Licence.
  3. Create a Permission Set that includes the "Campaign Influence" App Permission.
  4. Assign user(s) to that Permission Set.
Followup Q: "What does this do for me?"

Followup A: Buncha things.

  • Enables loading "associate this Campaign to this Opty" via the API
  • Enables credit for Campaigns to be broken out in percentages--instead of Primary Campaigns getting 100% credit 
  • On Campaign Page Layout: replaces old "Opportunities" Related List with "Influenced Opportunities" Related List, which shows
    • All influenced Optys, not just Primary Optys
    • Influence (%)
    • Revenue Share ($)
  • On Opty Page Layout: upgrades "Campaign Influence" Related List to show
    • Influence (%)
    • Revenue Share ($)
  • This REMOVES the "Add to Campaign" button from Opportunity's "Campaign Influence" Related List:*
  • This BREAKS the old Related Lists on your Campaign and Opportunity Page Layouts. Follow the steps here to set up the NEW AND IMPROVED Related Lists.
* This can be addressed by creating an unlocked Custom Campaign Influence Model, but that brings its own challenges (most notably, you gotta create homebrew Auto-Assign Rules using Workflow, Flow, Triggers, or--ye gods--Process Builder).

New Google Sheet, fast

posted Mar 14, 2017, 12:03 PM by Ezra Kenigsberg   [ updated Mar 15, 2017, 12:39 PM ]

Q: "How do I make a new Google Sheet, quickly?"

I just created an AutoHotKey shortcut for myself so that I can get spreadsheeting with Google Sheets almost as fast as I do with Excel. 

Gasp. After 25 years of Excel (and Lotus 1-2-3; and WordPerfect and Word; and Harvard Graphics and Freelance Graphics and PowerPoint)--will my default "I've gotta make a document" impulse be toward a cloud-based app?

Which reminds me: The History of VisiCalc is one of my favorite pages on the web. Nerdriffic!

* These are slightly-briefer versions of the Google URLs:

Bulleted and numbered lists: update

posted Dec 14, 2016, 10:03 AM by Ezra Kenigsberg   [ updated Dec 14, 2016, 10:09 AM ]

Q: "How do I create bulleted and numbered lists within a cell in Excel?"

A: Short answer: download this add-in, activate the add-in in Excel (File | Options | Add-Ins), and use the functions =BULLET() and =NUMBER().

Long answer: I posted about this three years ago (gosh, time flies). It took me that long to realize that I shoulda written it to accept quoted text within the cell, like this:
(in case you forgot, hard returns are entered in Excel by pressing Alt+Enter). The result looks like this:
I narrowed the column to show how nicely =BULLET() formats it. Check out those groovy hanging indents. Lovely!

The BULLET() function takes up to three arguments:
  1. (required) the text (typically a cell reference) to be shown in bulleted format
  2. (optional) nudge left indent for wrapped lines (default is 0)
  3. (optional) nudge right margin for all lines (default is 0; positive numbers make lines longer, negative numbers make lines shorter)
The NUMBER() function takes up to four arguments:
  1. (required) the text (typically a cell reference) to be shown in list-numbered format
  2. (optional) adjust the starting list number, 1, of the cell by X (default is 0)
  3. (optional) nudge left indent for wrapped lines (default is 0)
  4. (optional) nudge right margin for all lines (default is 0; positive numbers make lines longer, negative numbers make lines shorter)
Added bonus for Jira fans! Here's how ya do bullets embedded in numbered lists (and vice versa) in Jira:

Convert CSV (comma-separated value file) to TSV (tab-separated value file)

posted Oct 25, 2016, 9:36 AM by Ezra Kenigsberg

Q: "How do I convert a CSV (comma-separated value file) to a TSV (tab-separated value file)?"

A: On a Windows PC:
  1. Copy the code in this post.
  2. Open Notepad.
  3. Paste the code copied in step 1.
  4. Save the file as CSV2TSV.vbs into whatever directory contains your CSVs.
  5. In Windows Explorer, double-click CSV2TSV.vbs.
That should do it! Props to Frank for the question, and to Jojo for the answer!

Passing parameters to Reports in Lightning

posted Oct 24, 2016, 6:00 AM by Ezra Kenigsberg   [ updated Oct 24, 2016, 9:34 AM ]

Q: "How do I pass parameters to Reports in Lightning?"

A: You don't. Not yet. 

Salesforce says* as of Spring '17, it'll be:
/one/[{"value":"your value goes here","operator":"equals","column":"your field name goes here"}]

I'm skeptical about that Spring '17 prediction. Parker Harris said true Inline Editing was coming with Winter '17, and it didn't (and it's not on the roadmap for Spring '17, either).

In Classic, this ancient feature is implemented using:

* Merci to Laurent Lemasurier!

Is this a bug? Job scheduled via Immediate Window shows up wrong in UI

posted Sep 11, 2016, 5:41 PM by Ezra Kenigsberg   [ updated Sep 13, 2016, 7:34 AM ]

Is this a bug?

When I schedule a job via the Immediate Window using this command. . .
System.schedule('Batch Update Contacts (Daily at 2:00 PM)', '0 0 14 * * ?', new ScheduleBatchUpdate_Contacts());

. . . this is what shows up in Setup | Monitoring | Scheduled Jobs:

The UI has it wrong: this job will run every day, NOT just on the first of each month.

I was surprised I didn't find any hits on the intarwubs. I'm posting to StackExchange and see if anyone has insight.

In the meantime, I'd say:
a job that can be scheduled via the UI should be scheduled via the UI, not the Immediate Window.  
any job that runs once-daily or less should be scheduled via the UI.

2016-09-13 addition: 
Yup, it's a bug. 

Using the string below runs the same schedule from the Immediate Window. . .
System.schedule('Batch Update Contacts (Daily at 2:00 PM)', '0 0 14 ? * Sun,Mon,Tue,Wed,Thu,Fri,Sat', new ScheduleBatchUpdate_Contacts());

. . . and shows up correctly in the UI:

Making sense of Process Builder error messages

posted Jul 17, 2016, 3:13 PM by Ezra Kenigsberg   [ updated Jul 17, 2016, 3:20 PM ]

Q: What does this error message mean? How can I get something useful out of it?
The record couldn’t be saved because it failed to trigger a flow. A flow trigger failed to execute the flow with version ID 301A0000000LL8Z.
Contact your administrator for help.

A: Despite the Flow-specific wording, the message means either a Flow or a Process failed.

With a little URL hacking, you can at least know which Flow or Process caused the problem.* Replace the XXX in the URL below with the error message's ID:

(If you're outside of North America, or you're using sandbox, or you've got some My Domain settings in place, you'll probably need to replace the "na30" part of the URL as well.)

Bam! You should be taken to the Flow or Process that generated the error, something like this:

This is the point where Button-Click Admins say "Wait! I created a Process, using Process Builder. Why am I looking at a Flow?"

The answer: Processes are Flows! Process Builder is an interface for creating unfancy Flows, which Salesforce calls Processes. I encourage you to read how much I love Processes.

* To Salesforce's credit, they're working on making this message less cryptic, with an error email that gets sent to the admin. That email gives specifics about which Flow or Process failed, when, and how.

Why you shouldn't use Process Builder

posted Jul 16, 2016, 4:55 PM by Ezra Kenigsberg   [ updated Jul 17, 2016, 3:21 PM ]

Q: "Why should I use Workflow when there's Process Builder?"

A: Two big reasons: Processes give lousy error messages, and Processes can break data loads.

Let's break it down!

1)    Processes give lousy error messages.

Here're the error messages returned by Workflow and a Process. Can you guess which is which?
Error Message A:
Error Message B:

Give yourself a Kewpie Doll if you correctly surmised that Process returned message A, and Workflow returned message B.

Notice that message A, the Process message, is annoyingly cryptic:
  • It says a Flow failed, which is wrong. A Process failed.*
  • It gives an ID that's almost completely useless.*
  • It doesn't tell you which field caused the problem.
  • It doesn't tell you which value caused the problem.
Compare that to message B, the Workflow Field Update message:
  • It correctly tells you a Workflow or Approval caused the error.
  • It tells you the field that caused a problem.
  • It tells you the bad value in that field.
2)    Process Builder can break data loads.

Processes are subject to many of the same limits as Apex Triggers. Workflow Rules are not subject to those limits.

Salesforce ought to warn users: if you build a Process with Process Builder, you should perform load testing before deploying that Process to Production.

I encourage you, when considering automation, to try mighty hard to do it with clever configuration or Workflow.

Process Builder brings a bunch of risks that, if you can't solve your problem with config or Workflow, are better addressed by Flow or Apex Triggers.

* What's the heck's up with that ID? And why does Salesforce say the Process is a Flow? Great questions! Tune in tomorrow for the answers.

Which automation tool should I use?

posted Jul 1, 2016, 12:53 PM by Ezra Kenigsberg   [ updated Jul 1, 2016, 12:53 PM ]

Q: "How should I decide among Approvals, Workflow, Process Builder, Flow, and Apex Triggers?"

A: A good guideline is "use the simplest tool that gets the job done."

Salesforce has a comparison table, but I don't think it's well-executed. I humbly recommend my own, which has more information and is organized from simple-to-complex:

1-10 of 164