Automation Champion

Automating Salesforce One Click at a Time
Automation Champion
  • Home
  • About Me
    • Testimonials
    • Resources
  • Process Builder
  • Salesforce Flow
  • Pardot
  • Apex
  • Training Details
    • Salesforce Administrator
    • Salesforce Advanced Administrator
    • Platform App Builder
    • Lightning Flow
    • Pardot
    • Sales Cloud
    • Service Cloud
    • Community Cloud
    • Hands-on Excercises
  • My Books
  • Contact Me
  • Tag: Force.com

    • Auto Follow and Auto Unfollow records based on Criteria – Part 2

      Posted at 8:45 PM by Rakesh Gupta, on July 18, 2014

      In the last article Auto Follow and Auto Unfollow records based on Criteria – Part 1, I have gone through the way to automate Follow records process based on user defined criteria. In this article, I will discuss a way to automate Unfollow records based on criteria.

      Business Use Case

      Higher management at Universal Container wants to a develop an App for Auto Unfollow Opportunity records based on user defined criteria.

      Solution for the above business requirement

      First of all create one object to save condition to auto Unfollow records. In this demo I will create an object called as Opp Unfollow to Unfollow Opportunity object records. You can Add/Remove fields as per your requirement. I want to give the option to my users to auto Unfollow records based on Opportunity Owner and Amount. Create object and field as per the below screenshot

      Object to save condition for auto Unfollow

      Object to save condition for auto Unfollow

      To develop this application follow the below instructions

      1) Click on Name | Setup | App Setup | Create | Workflows & Approvals | Flows
      2) Click on New Flow, it will open flow canvas for you
      3) First create few Variables as shown in the below screenshot

      Variables

      Variables

      4) Drag and Drop Fast Lookup  (Give the name Get all Opportunities) on the window to get all Opportunity fall under user defined value on record (Opp_Unfollow__c)

      To Get all Opportunities

      To Get all Opportunities

      5) Drag and drop a Loop Logic (Give the name Loop over Opportunity) on the window and extract value from Sobject Collection variable and pass it to Sobject variable, as shown in the below screenshot

      Loop over Opportunity

      Loop over Opportunity

      6) Now Compare with Opportunity id and subscriber id with EntitySubscription object record, to check whether the user is following same opportunity record or not. Save value in variable {!ExistorNot}. Drag and drop a Record Lookup (Give the name Entity Subscription) on the window and take help from the below screenshot

      Compare records with EntitySubscription

      Compare records with EntitySubscription

      7) Now Drag and Drop Decision element (Give the name Go Ahead or Not) on the window to check whether Sobject variable {!ExistorNot} is null or not null. If the variable is Null = False it means user is following those records

      Decision Element

      Decision Element

      8) Drag and Drop Assignment Logic (Give the name All in One) on the window and assign value from Sobject variable {!ExistorNot} to Sobject Collection variable {!Del} so at the end of for loop it will delete all records from  EntitySubscription object. Take the help from the below screenshot

      All in One

      All in One

      9) Finally drag and Drop Fast Delete (Give the name Delete all records) on the window to delete the records  from EntitySubscription object, so user will Unfollow those records, as shown in the below screenshot

      Auto Unfollow Records

      Auto Unfollow Records

      10) Finally our flow will look like the below screenshot

      Auto Unfollow records

      11) Save the flow with name (Auto Unfollow Opp)  and close the canvas.

      Create Workflow rule to fire our Flow

      Our next task is to create a workflow on the Opp_Unfollow_c object on creation and every time it’s edited event. To create a workflow on the Opp_UnFollow_c object follow the below instructions

      1) Click on Name | Setup | App Setup | Create | Workflows & Approvals | New Rule
      2) Select object  Opp_Unfollow_c from the drop-down
      3) Enter Name, for Evaluate criteria  select Created, and any time it’s edited to subsequently meet criteria ( To create a time dependent workflow), For Rule Criteria select Start/Stop= False as shown in the following screenshot

      Workflow Rule1

      Workflow Rule1

      4) Now Add a time trigger to  to set Start/Stop flag True after 1hr of record last modification date. To do this click on Add Time Trigger button and Set the length after how many days/hours workflow will fire  i.e.  in hours and days, I selected 1hr after the Last Modified Date. Now add one field update action for time dependent workflow and set Start/Stop flag to True. You can take help from the following screenshot

      Time based action

      Time based action

      5) Save the workflow and activate it.
      6) Create another workflow (i.e. workflow2 ) on the same object to fire our Flow, set entry criteria of trigger is Start/Stop= True

      Workflow Rule2

      Workflow Rule2

      7) Add one Immediate Workflow Actions i.e. New Flow Trigger and Select Flow ( Auto Unfollow Opp) and set Variable (Amount, OwnerID and  SubscriberID) value as shown in the following screenshot

      New Flow Trigger Action

      New Flow Trigger Action

      8) Add one Immediate Workflow Actions i.e. New Field Update and Set Start/Stop flag to False, so it will queue the record for the next time.
      9) Save the workflow and activate it.

      It’s time to test this feature

      1) Now create one record in the object Opp Unfollow to save criteria to Auto Unfollow records, it will look similar to below screenshot

      Record on Unfollow Object

       2) To check time dependent workflow queue Follow the path, Click on Name | Setup | Administration Setup | Monitoring | Time–Based Workflow and search the queue

      Time-Based Workflow Queue

      Time-Based Workflow Queue

      Have feedback, suggestions for posts, or need more information about Salesforce online training offered by me? Say hello, and leave a message!

      Posted in Chatter, Salesforce Flow | 4 Comments | Tagged ADM 201, adm 201 certification, adm 201 salesforce, Advance flow, aligncenter, Auto Follow and Auto Unfollow based on Criteria, Auto Follow and Auto Unfollow records based on Criteria, Auto Follow records App Salesforce, Auto Follow records based on criteria, Auto follow Records in Chatter, Auto Follow Records in Chatter App, Auto follow Records in Chatter in Salesforce, auto follow records in salesforce, Auto follow records in Salesforce based on criteria, Auto Unfollow, Auto Unfollow record, auto Unfollow records, Auto unfollow records App, Auto Unfollow records App Salesforce, Auto Unfollow records based on criteria, Auto unfollow records in Chatter, Auto Unfollow Records in Chatter App, auto Unfollow records in salesforce, Chatter Auto Follow, Chatter Auto-Follow for Account & Sales Team Members, Cloud Flow Designer Workbook, Con 201, dev 401, DEV401, flow, Flow examples, Flow exmple, flow trigger, follow records, Following Records, Force.com, headless flow, How can I make users follow records automatically in Chatter, Mass follow records, Mass Unfollow records, New Flow, salesforce, salesforce certified developer exam, Salesforce Chatter Cloud Swarm, Searches related to auto follow records in salesforce salesforce chatter auto follow, The People and Records You Auto-Follow, Visual workflow, Visual workFlow examples, Visual Workflow Implementation Guide, Visual workflow Summer14 enhancement
    • Auto Follow and Auto Unfollow records based on Criteria – Part 1

      Posted at 3:47 AM by Rakesh Gupta, on July 18, 2014

       

      In Salesforce user can Follow and Unfollow records by clicking on iconFollow available on the record detail page. If you want to automate this Follow/Unfollow process based on some criteria then you have to use AppExchange App or build your own app by using Apex code. In this article, I will show how you can build this app without using any code. This is the first article of this series in this I will discuss auto Follow records, In next article, I will discuss auto Unfollow records.

      Business Use Case

      Higher management in Universal Container wants to a develop an App for Auto follow Opportunity records based on user defined criteria.

      Solution for the above business requirement

      First of all, create one object to save condition to auto follow records. In this demo, I will create an object called as Opp Follow to follow Opportunity object records. You can Add/Remove fields as per your requirement. I want to give the option to my users to auto follow records based on Opportunity Owner and Amount. Create object and field as per the below screenshot

      Object to save condition for auto Follow

      Object to save condition for auto Follow

      To solve this requirement we will use Visual Workflow. Before going ahead with the solution you have to understand about EntitySubscription Object. It’s Represents a subscription for a user following a record or another user. User can subscribe to a record or to another user.

      Field Name Details
      ParentId ID of the record or user which the user is following
      SubscriberId ID of the User who is following the record or user

      To develop this application follow the below instructions
      1) Click on Name | Setup | App Setup | Create | Workflows & Approvals | Flows
      2) Click on New Flow, it will open flow canvas for you
      3) First create few Variables as shown in the below screenshot

      Variables

      Variables

      4) Drag and Drop Fast Lookup  (Give the name Get all Opportunities) on the window to get all Opportunity fall under user defined value on record (Opp_Follow__c)

      To Get all Opportunities

      To Get all Opportunities

      5) Drag and drop a Loop Logic (Give the name Loop over Opportunity) on the window and extract value from Sobject Collection variable and pass it to Sobject variable, as shown in the below screenshot

      Loop over Opportunity

      Loop over Opportunity

      6) Now Compare with Opportunity id and subscriber id with EntitySubscription object record, to check whether the user is following same opportunity record or not. Save value in variable {!ExistorNot}. Drag and drop a Record Lookup (Give the name Entity Subscription) on the window and take help from the below screenshot

      Compare records with EntitySubscription

      Compare records with EntitySubscription

      7) Now Drag and Drop Decision element (Give the name Go Ahead or Not) on the window to check whether Sobject variable {!ExistorNot} is null or not null. If the variable is Null = True it means user is not following those records

      Decision Element

      Decision Element

      8) Drag and Drop Assignment Logic (Give the name Assign Subscriber ID) on the window and assign the value to Sobject variable {!ExistorNot} as shown in the below screenshot

      Assignment Logic

      Assignment Logic

      9) Drag and Drop Assignment Logic (Give the name All in One) on the window and assign value from Sobject variable {!ExistorNot} to Sobject Collection variable {!MassAdd} so at the end of for loop it will create records in EntitySubscription object to follow records. Take the help from the below screenshot

      All in One

      All in One

      10) Finally drag and Drop Fast Create (Give the name Create Records) on the window to create the records in EntitySubscription object, to follow the Opportunity records, as shown in the below screenshot

      Auto Follow Records

      Auto Follow Records

      11) Finally our flow will look like the below screenshot

      Auto Follow Records Based on Criteria

      Auto Follow Records Based on Criteria

      12) Save the flow with name (Auto follow Opp1)  and close the canvas.

      Create Workflow rule to fire our Flow

      Our next task is to create a workflow on the Opp_Follow_c object on the creation and every time it’s edited event. To create a workflow on the Opp_Follow_c object follow the below instructions

      1) Click on Name | Setup | App Setup | Create | Workflows & Approvals | New Rule
      2) Select object  Opp_Follow_c from the drop-down
      3) Enter Name, for Evaluate criteria  select Created, and any time it’s edited to subsequently meet criteria ( To create a time-dependent workflow), For Rule Criteria select Start/Stop= False as shown in the following screenshot

      Workflow Rule1

      Workflow Rule1

      4) Now Add a time trigger to set Start/Stop flag True after 0hr of record last modification date. To do this click on Add Time Trigger button and Set the length after how many days/hours workflow will fire  i.e.  in hours and days, I selected 0hr after the Last Modified Date. Now add one field update action for time-dependent workflow and set Start/Stop flag to True. You can take help from the following screenshot

      Time based action

      Time-based action

      5) Save the workflow and activate it.
      6) Create another workflow (i.e. workflow Rule2 ) on the same object to fire our Flow, set entry criteria of trigger is Start/Stop= True

      Workflow Rule2

      Workflow Rule2

      7) Add one Immediate Workflow Actions i.e. New Flow Trigger and Select Flow ( Auto follow Opp1) and set Variable (Amount, OwnerID and  SubscriberID) value as shown in the following screenshot

      New Flow Trigger Action

      New Flow Trigger Action

      8) Add one Immediate Workflow Actions i.e. New Field Update and Set Start/Stop flag to False, so it will queue the record for the next time.
      9) Save the workflow and activate it.

      It’s time to test this feature

      1) Now create one record in the object Opp Follow to save criteria to Auto Follow records, it will look similar to below screenshot

      Demo Record

       2) To check time dependent workflow queue Follow the path, Click on Name | Setup | Administration Setup | Monitoring | Time–Based Workflow and search the queue

      Time-Based Workflow Queue

      Time-Based Workflow Queue

      Auto Follow and Auto Unfollow records based on Criteria – Part 2
      Note :- To migrate from Workflow rule to Process builder please see my comment :- https://automationchampion.com/2014/07/18/auto-follow-and-auto-unfollow-records-based-on-criteria-part1/#comment-1705

      Have feedback, suggestions for posts, or need more information about Salesforce online training offered by me? Say hello, and leave a message!

      Posted in Chatter, Process Builder, Salesforce Flow | 21 Comments | Tagged ADM 201, adm 201 certification, adm 201 salesforce, Advance flow, aligncenter, Auto Follow and Auto Unfollow based on Criteria, Auto Follow and Auto Unfollow records based on Criteria, Auto Follow records, Auto Follow records based on criteria, auto follow records in salesforce, Auto follow records in Salesforce based on criteria, auto Unfollow records, auto Unfollow records in salesforce, Chatter Auto Follow, Chatter Auto-Follow for Account & Sales Team Members, Cloud Flow Designer Workbook, Con 201, dev 401, DEV401, flow, Flow examples, Flow exmple, flow trigger, follow records, Following Records, Force.com, headless flow, How can I make users follow records automatically in Chatter, How to Create New Process, Lightning Process builder, Mass follow records, Mass Unfollow records, New Flow, Prcoess Builder, Process Builder example, salesforce, salesforce certified developer exam, Salesforce Chatter Cloud Swarm, Searches related to auto follow records in salesforce salesforce chatter auto follow, The People and Records You Auto-Follow, Visual workflow, Visual workFlow examples, Visual Workflow Implementation Guide, Visual workflow Summer14 enhancement
    ← Older posts
    • Search

    • Upcoming Trainings

      Salesforce Administrator Certification
      Salesforce Advanced Administrator Certification
      Salesforce Platform App Builder Certification
      Lightning Flow & Process Builder
      Advanced Lightning Flow
      Pardot Specialist & Consultant Certification
      Sales Cloud Consultant Certification
      Service Cloud Consultant Certification
      Community Cloud Consultant Certification
    • Sponsor #1

    • Sponsor #2

    • Sponsor #3

    • Sponsor #4

    • Order Now!

    • Buy My Book

    • Buy My Book

    • Recent Posts

      • Getting Started with Salesforce Flow – Part 58 (Customize Previous, Next, Finish, and Pause Button Label for Screen Flow!)
      • Streamline Data Collection with Salesforce-Connected Forms
      • Getting Started with Salesforce Flow – Part 56 (Merge Chatter Topics with the Help of Salesforce Flow)
      • Getting Started with Salesforce Flow – Part 57 (Adding Validation to Flow Screen Components)
      • Getting Started with Salesforce Flow – Part 55 (Add or Remove Followers to a Record with the Help of Salesforce Flow)
    • Salesforce ID Converter Build on Lightning Flow

      Converting 15 digit ID to 18 digit Salesforce ID
    • Blog Archives

    • Categories

  • Information

    • About Me
    • Affiliate Disclaimer
    • Contact Me
    • Privacy Policy
  • Top Posts

    • Learning Flow
    • Learning Process Builder
    • Getting Started with Salesforce Flow – Part 27 (Want to Send an HTML Email from Salesforce Flow? Oh, yes! It can be done!)
    • Salesforce Spring’21 Release Quick Summary
    • Getting Started with Salesforce Flow – Part 11 (Count Number of records in a Record Collection Variable)
    • Getting Started with Salesforce Flow – Part 58 (Customize Previous, Next, Finish, and Pause Button Label for Screen Flow!)
    • Getting Started with Salesforce Flow – Part 42 (Running a Flow in System Mode)
    • Learning Apex
    • Getting Started with Salesforce Flow – Part 28 (Have a File Upload Component and Other Details on a Single Screen? Really? Wow!)
    • Getting Started with Salesforce Flow – Part 24 (Automatically Assign Permission Sets to New User)
  • Social Media

    • View Automationchampion’s profile on Facebook
    • View Automationchamp’s profile on Twitter
    • View Rakeshistom’s profile on GitHub