Projects to Build


  • Projects to Build

    • Time to put your new skills to work and build something useful!

  • Set your Chatter Out of Office Message

Chatter has an Out of Office function that you can either set manually or you could build a simple flow to set it.

The first thing you must do is allow all users to be able to set Out of Office messages:



Your finished flow will have three elements like this:



In the screen element, add two date fields and a text field:



Complete the date field and add validation so the date must be greater than yesterday:



Click the Validate Input link to open that section:



Add the end date settings and validation:



Click the Validate Input link to open that section:



Add the settings for the Message - maybe you can spell currently correctly smile



Next, create a new variable of type record (OutOfOffice) to take your screen input and pass to the create record element.



Add a new Assignment element and populate the fields of the new record.

Note: You also need to pass the UserID and the Is Enabled fields too.



Finally, add a create records element and use your record as the parameter:



Save and activate, then run your flow:



If everything went right, your user account should display like this (with or without the spelling mistake!)



One place you could add this flow is to the Utility Bar.

From the App Manager, select your app eg Lightning Sales:



Add a Utility Item and select your new flow:



Go back to your App and see the results (refresh the page):


Disable a User Account


Just a simple flow that can be used to disable a user account.

Create a new screen flow, it will have these elements when completed:



Add a screen element and give it a name:



Add a display text component:



Add a picklist component:



Create a new Choice resource (type = Record Choice Set).

Filter out those user accounts that are inactive or have no company name - to exclude the built-in accounts:



Add an Update Record element:

Note: The Current Record ID is under the $Flow:


Save, activate and run the flow:




Bulk Delete Leads


Bulk Deletion of Leads from a List View


In this mini-project, create a screen flow that will allow you (as an admin) to bulk delete lead records from a list view.


This is what your final flow will look like:



Create a new screen flow and add a decision element to see if the user running this is a system administrator:



If not admin, add a screen element to display an error message:



Create a new variable to hold the IDs of the selected lead records.

Note it must have this exact name "ids", allow multiples and be available for input.



Add a new variable to count records:



Assign your record_counter variable equal to the number of records selected for deletion (from "ids"):



Display a warning message (screen):



Add a loop to go thru the ids:



Add a new variable for a lead record (single) that you will use inside the loop:



Add a new variable for a collection of lead records (the ones you will be deleting) - also used inside the loop:



Set the ID for the lead record (to be deleted) to be that from the current item in the loop (inside the loop):



Add the record to the record collection (inside the loop):



Delete the records in the collection (outside the loop):



Add a confirmation message after deletion:



Add a new List Button to run your flow from the list view:



Define the button as follows:



The list button needs to be added to the Search Layouts -> Default Layout (not a page layout):

Tip: Nathan Underwood suggests that you may need to also add this to the Search Layouts for Salesforce Classic (similar to the above).

Make the button available:



Open the leads tab and display a list view.

Select several leads (1) and click Bulk Delete:



The verify message displays:
(you can ignore the Lightning out App error - this is a known bug)



The records are deleted and the confirmation message is displayed:

Note: You can easily change this flow to work with another object eg Account or Contact records.


Flow Magic Picklists


This is what you are building:



Install Flow Magic

Flow Magic is a Salesforce Labs AppExchange App that you can install to provide graphic displays for picklist values.

Start by installing the App: https://appexchange.salesforce.com/appxListingDetail?listingId=a0N3A00000FeFBAUA3



Flow Magic Picklists Setup Instructions

https://salesforce.quip.com/tJYNAjcCFYWn

Do these three steps from the link above:

  1. Create Static resource for picklist configuration



  2. Custom setting for static resource name





  3. Add remote site





Customize Account Fields

Next, you need to customize the picklist values on the Account object (so we don't have too many values).

  • Rating: Values Hot, Warm, Cold
  • Ownership: Public, Private, Subsidiary
  • Industry: Restrict to only 12 values
  • Account Source: Web, Phone Inquiry, Partner Referral, Other



Find/Create some images

Next, you need three images for your picklist values eg hot, warm, cold. Use square images about 200-300 pixels wide/high.

You may find something suitable in Google images smile

Upload these as static resources (and remember their names!)

Make sure the Cache Control is set to PUBLIC when creating these static resources.






Start the Flow Magic App




Configure Account Rating


Select the object (1) and picklist field (2) then click edit (3).

You will now configure the images for this picklist:




For the Hot value, select the Image URL button (1) then edit the Image URL (2).

For static resources, the prefix will be /resource/<resourcename>

Add the resources for the three static resources (images) you uploaded earlier. If you get the name right, the image will display.

Click Save (3) when you have done these three.



Configure Ownership

Next, configure the Ownership picklist, but this time the images will come from the Lightning Design System.

Take a look at this link to see all the icons you can choose from:

https://lightningdesignsystem.com/icons/


Values I used for the Lightning Icons were: (you can use any icons you wish)

  • Public - standard:buyer_group
  • Private - standard:password
  • Subsidiary - standard:hierarchy



Configure Industry


Values I used for the Lightning Icons were: (you can use any icons you wish)

  • Agriculture - custom:custom80
  • Communications - custom:custom112
  • Construction - standard:service_crew_member
  • Education - standard:education
  • Electronics - custom:custom71
  • Finance - standard:lightning_usage
  • Government - custom:custom16
  • Healthcare - custom:custom1
  • Retail - standard:checkout
  • Shipping - custom:custom92
  • Technology - custom:custom113
  • Utilities - standard:lightning_component



Configure Account Source

Values I used for the Lightning Icons were: (you can use any icons you wish)

  • Web - custom:custom68
  • Phone Inquiry - standard:voice_call
  • Partner Referral - standard:service_resource
  • Other - standard:lead


Build your Flow

Now all the hard work is done, it's time to build your flow.

Start with a new Screen flow.

You will need to add four new Screen elements:



Each of these elements is very similar:

Drag the new picklist component to the canvas (note: this is NOT the standard component but one with the same name located under the custom group of components - part of Flow Magic).



The configuration settings for the four screens are:

  1. Object Name (all are using this object)
  2. Picklist Field Name (depends on the one you are displaying)
  3. Alignment: Left (for all)
  4. Image Size: Large (for all)
  5. Size: Small (for all)

You may want to add a Display Text component above the picklist for each page.

Account Source:




Ownership:



Industry:



Rating:



Save and Run your flow.






Note: This flow does not create accounts or save any of the selections you have made.

You can access the values selected in the picklists via the screen component and the selected value as shown below.






Now you can add some magic to your flows!



When Opportunity is lost, set contact to same loss reason (for Ariel)




This question came from Ariel:
Ariel Dana Ron - Wed, 5 May 2021, 6:21 PM
Hi smile Is there anything in the course that shows how to update a record on a related object using a record triggered flow? Example scenario: Pseudocode for Flow:
IF an Opportunity changes to Closed Lost and Loss Reason = Not-Interested
THEN find the Primary Contact related to that opportunity AND change the Contact Status to Not Interested. TIA
-----------------------------------------------------------------------------------

To solve this first, we need a few additional fields that do not exist in a standard developer org:
Picklist Value Set: Loss Reasons
Opportunity: Loss Reason (picklist) using the global value set
Opportunity Contact: (Lookup on contact)
Contact: Loss Reason (picklist) using the global value set

Picklist Value Set

Why do we need this, why not just create the two picklists and add the values manually? Well, you could do this but it's not best practice. The two lists have the same values and can get out of sync if you forget to update the second one when adding new values so the value set prevents this.
Create the picklist value set:



Now use that when creating the new Loss Reason field on the Opportunity object:


and do the same for the Contact object:


Next, create a new Record Triggered flow. When finished it will look like this:


Set the values for the start:


Trigger when a record is updated and run the flow after save. This is important, because we are not updating the opportunity but the related contact record so we must run the flow after the change made to the opportunity has been saved.


The criteria for the flow to run is:


Next we add an Update Record element and configure as follows:


That's it!  Now you can edit an opportunity, make sure you have an Opportunity Contact, change the stage to Closed lost and add a loss reason:


Now check the contact and the Loss Reason should have been added:


The end.

No comments: