Triggers to Create Tasks in Salesforce: Come and See Video

Triggers in Salesforce: CAS Come and See will show you how to write a trigger to create automatic tasks in Salesforce. CAS Come and See videos show you how to customize your Salesforce instance to do amazing things.

Join Jarrett from Cloud Adoption Solutions, as he shows you step by step how you can create triggers in Salesforce!

 

VIDEO TRANSCRIPT:

Hey, guys, it’s Jarret from Cloud Adoption Solutions; today we are going to write a trigger that we actually might use. This one’s going to be on the opportunity, and it’s going to add a follow up task when the opportunity is marked close one. So first, we’re going to start going into the dev console, we’re going to select an apex trigger, we’re going to call it the closed off trigger, maybe not. And call it another closed out trigger.

Alright, and this one is going to work either when the opportunity is created, and marked Closed Won, or after it’s updated to Closed Won. So we’re gonna say after insert after update. So we’re gonna create a new list of tasks. And then we’re gonna populate that list as we iterate through the opportunities. So here, we’re gonna create our iterator and then do a soql query. ID name from opportunity. We’re adding in curly braces on there, so it doesn’t yell at us. And then we’re gonna do a little “if” statement. And check the stage name. It passes that; we’re going to add it to the task list. And here we’re gonna create a new task: Very important follow up task. Then we’re going to use the word ID to relate it to the opportunity.

Alright, here’s the basic functionality, and we’re gonna look at the task list list to see if it is larger than zero. So if it’s not empty: see if this works. No problems for once. Yeah, let’s go check it on opportunity. So we will go into this one. This looks good. All right, we’re gonna close it. And we’re gonna win it. There we go. Very important follow up task. Alright, that’s it.

 

 

Don’t miss this event!

The ONLY Conference for Sales, Marketing, RevOps, and Commercial Executives in the Life Sciences Industry.

Follow Us

Related Posts