Wizard’s Apprentice Lightning Experience – Sobject Variables, Collections & Loops Revisted

 Wizard’s Apprentice: Sobject Variables, Collections & Loops Revisted

Thank you everyone who has watched these videos and left me comments. I do my best to read and respond to each one.

One of the most common questions I’ve gotten is about sObject Variables, Sobject Collections and Loops. Lots of requests for clarification.

In this video, I change our metaphor a bit. This came from my dear friend Mark Ross (salesforceYoda). We presented this in a Hands-On-Training (HOT) at Dreamforce 2015. You can find this session here: http://www.salesforce.com/campaigns/success-services/sfu-hands-on-training-sessions.jsp The session you’ll want is “Build Advanced Flow with Loops and Fast Elements.”

I hope this helps clarify how sObject Variables, Collections, and Loops work. As always if you have any requests for what else you’ll like to see or learn about, please leave a comment. Leaving a Like on the video also helps out a great deal.

Some sounds effects were provided by: http://www.freesfx.co.uk

Showing 2 comments
  • Sara Herrera

    Brian, this is helpful! I have a question…not sure if this is possible, so I’m hoping your expertise will be useful.

    The end game is this: I wanted to create an object that would summarize company-wide sales for each of our major channels, and have some fields do calculations on the data (evaluating performance to goal, etc.) Right now, the way this info is distributed to the masses is we have a report that runs (in SFDC), we save a copy of the file to our shared drive and enter it into an excel template that does some basic calculations on the data (performance to daily goal, monthly goal, annual goal for each channel). All the data exists in Salesforce (our sales data and territory goals) and I think there has to be a way to do this in the system.

    I was thinking, if I create an object that is related to the territory object and the territory goal object, I would be able to pull data from both objects in to create one record per day that summarizes sales and performance to goal. To do that, I’ve been trying to create a flow that loops through a collection of an object in my org (“Territory”). I am using a fast lookup to find all territories with channel of “National”. I want to get all the territory records in the National Channel and grab three fields off each record (Yesterday Sales, MTD Sales and YTD sales). At the end of the collection, I wanted to be able to assign the total of all the fields to the fields I created on my “Daily Sales” object for Yesterday Sales, MTD Sales and YTD Sales. However, I don’t think that I can get there because I need to be able to get the total of all the values I find doing the loop.

    Does this make sense? Is it possible? Do I need to provide more detail? I’m hoping this finds you well and you have some time to knock your brain against this scenario.

    Thanks in advance!

    • Brian Kwong

      sara, I thought I replied but apparently I must have dreamed it. My very first Dreamforce sessions was about taking External Data and getting it Salesforce for reporting purposes. Some of the concepts in there could fit. Basically, unless you MUST have the details, summarize the data and create an object to put the summary of data there – then report off of that. It’s kind of like creating your own snapshot.

      You COULD use flow or apex to create the records based on your opportunity data, but my recommendation would be to start first with the custom object and create some records using the ole Export/import method. Once that has shown to be effective – then worry about trying to automate the creating of the records.

Leave a Reply