Sunday, January 21, 2018

Test Class for your Marketing Cloud Trigger

When using the Salesforce Marketing Cloud Connector to enable Marketing Cloud access from Sales and Service Clouds, folks often want to perform a triggered send when a specific event occurs. To do so, one must create a trigger on the desired object.  For example, let's say you allow loyalty signups from your web site. Upon signup, you create a new contact record in Salesforce Sales Cloud. Best practice is to send an email to the user right away. This gives users a level of confidence they actually signed up. You might also want to send a verification link, etc. However, let's keep it simple.

First, create your trigger on the Contact object. This must be named "Trig_Contact". Follow these instructions.

OK. Now I'm assuming you did this in a dev org since you can't create it in production. At this point, you're probably wanting to deploy your simple trigger to production so you can go on and create your send definition. Here's where you run into a problem. Salesforce kind of forgets to mention you need a test class.  To make matters worse, you might not be an APEX developer... so this is going to be fun.

If you want some background on test classes, read this help article.

Back already? Awesome. Let's get to it and create that test class.

  1. From Setup, enter Apex Classes in the Quick Find box, then select Apex Classes and click New.
  2. In the class editor, add the code below as the class definition, and then click Save.

@isTest
private class Trig_ContactTest {
static testMethod void myUnitTest() {
// TO DO: implement unit test
Contact testContact = new Contact(LastName = 'Test Contact', Email ='help@chrisbeckworth.com');
insert testContact;
testContact = [select Id, LastName from Contact where id = :testContact.Id];
System.assertEquals(testContact.LastName, 'Test Contact');
}
}
Great. Your all set. Now you need to make a changeset with your Contact trigger and test class. Upload that changeset to Production. Go into Production and deploy the changeset. Make sure, when deploying, to select the last option to only test items in the changeset.

Here's how to set up the send definition.
Here's more info on triggered sends in general.

Saturday, May 14, 2011

Start Rubbin'

Garlic and Mustard Dry Rub

1 tablespoon garlic powder
2 tablespoons ground black pepper
1 tablespoon salt
1 tablespoon mustard powder
1 tablespoon chili powder
1 tablespoon ground cumin
1 tablespoon brown sugar
4 tablespoons ground paprika
1/2 teaspoon dried oregano

Just mix it all together and then rub on steak. Then let the steak come to room temperature before grilling. Enjoy!

Wednesday, September 29, 2010

No Loss Situation

It’s a no loss situation; this means absence of any competing or non-competing losers. It’s like tee ball with no score and where every kid gets pizza, a snow cone, and the same “League Champs” trophy.

This is different from the clichéd "win-win" situation. If there are winners then there is at least 1 loser.

No loss is far better than win-win. Plus it's cliché worthy.

Tuesday, August 10, 2010

My Best Hummus

1 can (15 oz) garbanzo bean (chick peas) drained*
1/8 cup tahina paste
1/8 cup extra virgin cold pressed olive oil
1/2 tsp kosher salt
1/4 tsp paprika
1/4 tsp cumin
half a fresh lemon
some white pepper
crushed red pepper (garnish)

I usually make a double batch.

Instructions. Drain the beans, conserving the "juice." Add the beans, tahina, olive oil, salt, paprika, cumin into your blender. Squeeze the juice out of the lemon. Dash some white pepper in on top. Grab a wooden spoon or silicon (or rubber) scraper. Turn on the blender at it's slowest setting. Gentle push from the edges into the center just staying on top of the ingredients. Everything will blend. If it's too chunky add either (a) more olive oil (my preference), or (b) some of the "juice" you conserved.

I blend mine in my Kitchen Aid blender until I get to second highest setting and leave it on until the humus is light and fluffy; almost whipped. Everyone loves. Lately I've been adding some fresh garlic. Also, a teaspoon of truffle oil instead of garlic would be a gourmet touch.

Keep it simple. Serve directly on a plate in a big dollup drizze with a touch of olive oil and garnish with crushed red pepper. I like to use barbari bread from my local mediterranean market and it can also be found at Sam's. Pita bread is fine. Try your favorite flat bread. I cut mine in 3 inch square, warm in my counter-top toaster then cut into triangles.

Enjoy!

Monday, March 10, 2008

Strawberry Pineapple Smoothie

Here's a great lactose free shake I make for my wife. I say it's lactose free because it has no milk, but it does have yogurt. I use Activia. My wife has found that the Activia does not cause the same problems other milk products do.

Put the following items into your blender in this order:
1 cup of frozen strawberries
3/4 cup of frozen pineapple chunks
1/2 cup of plain or vanilla Activia yogurt
1/2 cup of rice milk
1 scoop of egg protein (vanilla or unflavored) we use Jay Robb's
some honey to taste

Wait... don't leave. When you blend, start at stir and move to liquify. Don't start on high. Pro smoothie machines do just that; go from slow to fast. It makes less mess, wastes less, and blends smoother AND faster with less air.

Enjoy.

Sunday, February 24, 2008

Sunday, January 27, 2008

Those Poor Hens

Below is a picture of the latest marketing trend for eggs: honesty in
what the hens a fed. However, I have to say I'm a bit appalled. Look
at what they claim to be feeding them!

Test Class for your Marketing Cloud Trigger

When using the Salesforce Marketing Cloud Connector to enable Marketing Cloud access from Sales and Service Clouds, folks often want to perf...