SlideShare a Scribd company logo
1 of 27
Salesforce Admin Group, Trichy
Alternate for Scheduled Apex
using Flow Builder
Kadhar Basha J
Salesforce Admin Group, Trichy
Trailblazer Community Group Leader
MST Solutions
Sundaravel J
Salesforce Admin Group, Trichy
Trailblazer Community Group Co-Leader
MST Solutions
Salesforce Admin Group, Trichy
Salesforce Admin Group, Trichy
Speaker
Padmavathy T
MST Solutions
Today’s Agenda
• What is a Schedule-Triggered Flow?
• Things to Note
• Apex Code - Example
• Alternate Elements for Apex Code
• Demo
• Questions & Answers
• Conclusion
What is a Schedule-Triggered Flow?
Logo
• It is an auto-launched flow introduced in Winter’20 release
• We can schedule it to start at a specific date and time
• Different frequencies to run
 Once
 Daily
 Weekly
• Runs for each record in the batch and stores record’s field values in
the $Record global variable.
• Scheduled-Trigged Flow always runs in System mode.
Things to Note
Logo
• The Start Time is based on the Salesforce org’s default time
zone.
• Start Time differs based on user’s time zone.
• View All Data permission required.
• Flow interviews per 24 hours is 2,50,000
• Flows are bulikfied
• We can see debug of the scheduled flow in debug logs
• We can track the number of records with the
FLOW_START_SCHEDULED_RECORDS event
Things to Note
Logo
• Deleting a schedule-triggered flow interview from the Scheduled
Jobs, all future recurrences of that flow are cancelled.
• Run as the Automated Process user.
• Enable Filter inaccessible fields from flow requests in your org’s
process automation settings. Otherwise, the flow fails because
the Update Records element tries to set the values for system
fields and other read-only fields.
• Using multiple filters defaults to AND for different fields.
Scenario
Logo
• Update: Tasks’ status to Auto-Closed
• Condition: If open non-recurring tasks’ Due date passed 7 days
• Schedule: Daily
Apex Code
Logo
global class CloseTasks_AC implements Database.Batchable<sObject>
{
global Database.QueryLocator start(Database.BatchableContext BC)
{
String query = 'SELECT Id, Status, Due_Date_Passed__c,
IsRecurrence FROM Task WHERE IsClosed = False AND
Due_Date_Passed__c = True AND IsRecurrence = False';
return Database.getQueryLocator(query);
}
global void execute(Database.BatchableContext BC, List<Task>
taskList){
Apex Code
Logo
List<Task> tasks = new List<Task>();
if(taskList.size() > 0)
{
for(Task tsk : taskList)
{
tsk.Status = 'Auto-Closed';
tasks.add(tsk);
}
}
Apex Code
Logo
if(tasks.size()>0)
update taskList;
}
global void finish(Database.BatchableContext BC)
{
}
}
Alternate Elements for Apex Code
Logo
global Database.QueryLocator start(Database.BatchableContext BC)
{
String query = 'SELECT Id, Status, Due_Date_Passed__c, IsRecurrence FROM Task WHERE
IsClosed = False AND Due_Date_Passed__c = True AND IsRecurrence = False';
return Database.getQueryLocator(query);
}
Alternate Elements for Apex Code
Logo
if(taskList.size() > 0)
{}
Alternate Elements for Apex Code
Logo
for(Task tsk : taskList)
{}
Alternate Elements for Apex Code
Logo
tsk.Status = 'Auto-Closed';
Alternate Elements for Apex Code
Logo
List<Task> tasks = List<Task>();
..
..
newtasks.add(tsk);
Alternate Elements for Apex Code
Logo
update taskList;
Alternate Elements for Apex Code
Logo
Scheduling a flow using Apex, Anonymous window or CRON Expression or through
Configuration
Launch
DEMO
Quiz
Logo
1) A screen flow can be launched using a custom link.
True
False
Ans: True. /flow/flow_Name
2) Schedule-Triggered flow can be scheduled monthly
True
False
Ans: False
Quiz
Logo
3) Can we create formula to filter records in flow?
Ans: No. We cannot directly create formula in flow.
We can create a formula field and use it in the flow.
4) Can we change the datatype of the variable created in the flow?
Ans: No
Quiz
Logo
5) Where can we find the scheduled flow interviews?
Ans: Scheduled Jobs
6) What will happen when we delete the flow interviews of active flow in
scheduled jobs?
Ans: Future recurrences of that flow are cancelled. To enable future runs,
deactivate and reactivate the flow.
Quiz
Logo
7) Which interface needs to be implemented in apex to be used in
the flow?
Ans: Using @InvocableMethod annotation with Static method
8) Where we can find all the elements used in the current flow?
Ans: Manager tab in the left panel
Quiz
Logo
9) A flow is failing as it tries to update the system and read only fields.
What you should do to get rid of this error?
Ans: Enable “Filter inaccessible fields from flow requests” in your org’s
process automation settings.
10) What will be the time zone for the date/time field values at run time?
Ans: Values reflect the time zone settings of the running user
Conclusion
• New version of Flow contains all those options which is available after
wrote a huge lines of code in Apex.
• We are free from test classes.
• Are you a low code lover, then you should proceed with the
automation.
Alternate for scheduled apex using flow builder

More Related Content

What's hot

Greg Hurlman: Developing Custom Service Applications
Greg Hurlman: Developing Custom Service ApplicationsGreg Hurlman: Developing Custom Service Applications
Greg Hurlman: Developing Custom Service Applications
SharePoint Saturday NY
 
Kathryn Birstein: SharePoint 2010 Business Intelligence-Brining It All Together
Kathryn Birstein: SharePoint 2010 Business Intelligence-Brining It All TogetherKathryn Birstein: SharePoint 2010 Business Intelligence-Brining It All Together
Kathryn Birstein: SharePoint 2010 Business Intelligence-Brining It All Together
SharePoint Saturday NY
 
Sharepoint developement tools(webparts+worflows) EBizSoft
Sharepoint developement tools(webparts+worflows) EBizSoftSharepoint developement tools(webparts+worflows) EBizSoft
Sharepoint developement tools(webparts+worflows) EBizSoft
Shakir Majeed Khan
 

What's hot (20)

F1_Design Mission Critical Enterprise Applications with Power Automate and Do...
F1_Design Mission Critical Enterprise Applications with Power Automate and Do...F1_Design Mission Critical Enterprise Applications with Power Automate and Do...
F1_Design Mission Critical Enterprise Applications with Power Automate and Do...
 
SharePoint 2013 i SharePoint Online
SharePoint 2013i SharePoint OnlineSharePoint 2013i SharePoint Online
SharePoint 2013 i SharePoint Online
 
Greg Hurlman: Developing Custom Service Applications
Greg Hurlman: Developing Custom Service ApplicationsGreg Hurlman: Developing Custom Service Applications
Greg Hurlman: Developing Custom Service Applications
 
Increase Adoption By Building Lightning Pages
Increase Adoption By Building Lightning PagesIncrease Adoption By Building Lightning Pages
Increase Adoption By Building Lightning Pages
 
An Introduction to Microsoft Flow
An Introduction to Microsoft FlowAn Introduction to Microsoft Flow
An Introduction to Microsoft Flow
 
Building a Microsoft Teams Provisioning Process using Power Apps & Power Auto...
Building a Microsoft Teams Provisioning Process using Power Apps & Power Auto...Building a Microsoft Teams Provisioning Process using Power Apps & Power Auto...
Building a Microsoft Teams Provisioning Process using Power Apps & Power Auto...
 
Digitalize your Approval processes with approvals in Microsoft Teams
Digitalize your Approval processes with approvals in Microsoft TeamsDigitalize your Approval processes with approvals in Microsoft Teams
Digitalize your Approval processes with approvals in Microsoft Teams
 
Limitations and Cost of Using Microsoft's Power Platform
Limitations and Cost of Using Microsoft's Power PlatformLimitations and Cost of Using Microsoft's Power Platform
Limitations and Cost of Using Microsoft's Power Platform
 
Microsoft Flow best practices European Collaboration Summit 2018
Microsoft Flow best practices European Collaboration Summit 2018Microsoft Flow best practices European Collaboration Summit 2018
Microsoft Flow best practices European Collaboration Summit 2018
 
Kathryn Birstein: SharePoint 2010 Business Intelligence-Brining It All Together
Kathryn Birstein: SharePoint 2010 Business Intelligence-Brining It All TogetherKathryn Birstein: SharePoint 2010 Business Intelligence-Brining It All Together
Kathryn Birstein: SharePoint 2010 Business Intelligence-Brining It All Together
 
Power Automate/ Flow patterns tips and tricks after 3 years with Doctor Flow
Power Automate/ Flow patterns tips and tricks after 3 years with Doctor FlowPower Automate/ Flow patterns tips and tricks after 3 years with Doctor Flow
Power Automate/ Flow patterns tips and tricks after 3 years with Doctor Flow
 
Winter15 Release Webinar Deck
Winter15 Release Webinar DeckWinter15 Release Webinar Deck
Winter15 Release Webinar Deck
 
Microsoft Viva Connections - Set up and Extend with SPFx
Microsoft Viva Connections - Set up and Extend with SPFxMicrosoft Viva Connections - Set up and Extend with SPFx
Microsoft Viva Connections - Set up and Extend with SPFx
 
PhillyForce 2018 - Salesforce Platform Keynote
PhillyForce 2018  - Salesforce Platform KeynotePhillyForce 2018  - Salesforce Platform Keynote
PhillyForce 2018 - Salesforce Platform Keynote
 
Visual Workflow Overview
Visual Workflow OverviewVisual Workflow Overview
Visual Workflow Overview
 
Migrating Lotus Notes Applications to Sharepoint Online with Nintex
Migrating Lotus Notes Applications to Sharepoint Online with NintexMigrating Lotus Notes Applications to Sharepoint Online with Nintex
Migrating Lotus Notes Applications to Sharepoint Online with Nintex
 
Sharepoint developement tools(webparts+worflows) EBizSoft
Sharepoint developement tools(webparts+worflows) EBizSoftSharepoint developement tools(webparts+worflows) EBizSoft
Sharepoint developement tools(webparts+worflows) EBizSoft
 
Electronic patients records system based on oracle apex
Electronic patients records system based on oracle apexElectronic patients records system based on oracle apex
Electronic patients records system based on oracle apex
 
Composite Applications Speaking Tour - Lap Around Office Business Architectures
Composite Applications Speaking Tour - Lap Around Office Business ArchitecturesComposite Applications Speaking Tour - Lap Around Office Business Architectures
Composite Applications Speaking Tour - Lap Around Office Business Architectures
 
Infor Process Automation Developer
Infor Process Automation DeveloperInfor Process Automation Developer
Infor Process Automation Developer
 

Similar to Alternate for scheduled apex using flow builder

adaidoadaoap9dapdadadjoadjoajdoiajodiaoiao
adaidoadaoap9dapdadadjoadjoajdoiajodiaoiaoadaidoadaoap9dapdadadjoadjoajdoiajodiaoiao
adaidoadaoap9dapdadadjoadjoajdoiajodiaoiao
lyvanlinh519
 
Advance Sql Server Store procedure Presentation
Advance Sql Server Store procedure PresentationAdvance Sql Server Store procedure Presentation
Advance Sql Server Store procedure Presentation
Amin Uddin
 
100 sap basis_interviwe_questions
100 sap basis_interviwe_questions100 sap basis_interviwe_questions
100 sap basis_interviwe_questions
bhaskarbi
 
...and thus your forms automagically disappeared
...and thus your forms automagically disappeared...and thus your forms automagically disappeared
...and thus your forms automagically disappeared
Luc Bors
 
Bb world 2012 using database statistics to make capacity planning decisions...
Bb world 2012   using database statistics to make capacity planning decisions...Bb world 2012   using database statistics to make capacity planning decisions...
Bb world 2012 using database statistics to make capacity planning decisions...
Geoff Mower
 

Similar to Alternate for scheduled apex using flow builder (20)

Java 8
Java 8Java 8
Java 8
 
adaidoadaoap9dapdadadjoadjoajdoiajodiaoiao
adaidoadaoap9dapdadadjoadjoajdoiajodiaoiaoadaidoadaoap9dapdadadjoadjoajdoiajodiaoiao
adaidoadaoap9dapdadadjoadjoajdoiajodiaoiao
 
Advance Sql Server Store procedure Presentation
Advance Sql Server Store procedure PresentationAdvance Sql Server Store procedure Presentation
Advance Sql Server Store procedure Presentation
 
Oracle applications r12.2, ebr, online patching means lot of work for devel...
Oracle applications r12.2, ebr, online patching   means lot of work for devel...Oracle applications r12.2, ebr, online patching   means lot of work for devel...
Oracle applications r12.2, ebr, online patching means lot of work for devel...
 
100 sap basis_interviwe_questions
100 sap basis_interviwe_questions100 sap basis_interviwe_questions
100 sap basis_interviwe_questions
 
Database continuous integration, unit test and functional test
Database continuous integration, unit test and functional testDatabase continuous integration, unit test and functional test
Database continuous integration, unit test and functional test
 
Sql storeprocedure
Sql storeprocedureSql storeprocedure
Sql storeprocedure
 
SharePoint 2013 Performance Analysis - Robi Vončina
SharePoint 2013 Performance Analysis - Robi VončinaSharePoint 2013 Performance Analysis - Robi Vončina
SharePoint 2013 Performance Analysis - Robi Vončina
 
Large Data Volume Salesforce experiences
Large Data Volume Salesforce experiencesLarge Data Volume Salesforce experiences
Large Data Volume Salesforce experiences
 
Database Fundamental Concepts- Series 1 - Performance Analysis
Database Fundamental Concepts- Series 1 - Performance AnalysisDatabase Fundamental Concepts- Series 1 - Performance Analysis
Database Fundamental Concepts- Series 1 - Performance Analysis
 
...and thus your forms automagically disappeared
...and thus your forms automagically disappeared...and thus your forms automagically disappeared
...and thus your forms automagically disappeared
 
05_DP_300T00A_Optimize.pptx
05_DP_300T00A_Optimize.pptx05_DP_300T00A_Optimize.pptx
05_DP_300T00A_Optimize.pptx
 
Oracle Database Performance Tuning Advanced Features and Best Practices for DBAs
Oracle Database Performance Tuning Advanced Features and Best Practices for DBAsOracle Database Performance Tuning Advanced Features and Best Practices for DBAs
Oracle Database Performance Tuning Advanced Features and Best Practices for DBAs
 
SFDC Batch Apex
SFDC Batch ApexSFDC Batch Apex
SFDC Batch Apex
 
Live Query Statistics & Query Store in SQL Server 2016
Live Query Statistics & Query Store in SQL Server 2016Live Query Statistics & Query Store in SQL Server 2016
Live Query Statistics & Query Store in SQL Server 2016
 
Docker Logging and analysing with Elastic Stack - Jakub Hajek
Docker Logging and analysing with Elastic Stack - Jakub Hajek Docker Logging and analysing with Elastic Stack - Jakub Hajek
Docker Logging and analysing with Elastic Stack - Jakub Hajek
 
Docker Logging and analysing with Elastic Stack
Docker Logging and analysing with Elastic StackDocker Logging and analysing with Elastic Stack
Docker Logging and analysing with Elastic Stack
 
Bb world 2012 using database statistics to make capacity planning decisions...
Bb world 2012   using database statistics to make capacity planning decisions...Bb world 2012   using database statistics to make capacity planning decisions...
Bb world 2012 using database statistics to make capacity planning decisions...
 
Ms sql server architecture
Ms sql server architectureMs sql server architecture
Ms sql server architecture
 
Application Performance Troubleshooting 1x1 - Part 2 - Noch mehr Schweine und...
Application Performance Troubleshooting 1x1 - Part 2 - Noch mehr Schweine und...Application Performance Troubleshooting 1x1 - Part 2 - Noch mehr Schweine und...
Application Performance Troubleshooting 1x1 - Part 2 - Noch mehr Schweine und...
 

More from KadharBashaJ

A Review on LWC Events for communication.pptx
A Review on LWC Events for communication.pptxA Review on LWC Events for communication.pptx
A Review on LWC Events for communication.pptx
KadharBashaJ
 
Tour to docgen lightning experience
Tour to docgen lightning experienceTour to docgen lightning experience
Tour to docgen lightning experience
KadharBashaJ
 

More from KadharBashaJ (20)

A Review on LWC Events for communication.pptx
A Review on LWC Events for communication.pptxA Review on LWC Events for communication.pptx
A Review on LWC Events for communication.pptx
 
Winter'23 Release Updates.pptx
Winter'23 Release Updates.pptxWinter'23 Release Updates.pptx
Winter'23 Release Updates.pptx
 
Asynchronous Apex .pptx
Asynchronous Apex .pptxAsynchronous Apex .pptx
Asynchronous Apex .pptx
 
Review on Data Security.pptx
Review on Data Security.pptxReview on Data Security.pptx
Review on Data Security.pptx
 
Flow With Aura.pptx
Flow With Aura.pptxFlow With Aura.pptx
Flow With Aura.pptx
 
Conga composer
Conga composerConga composer
Conga composer
 
Flow builder series i
Flow builder series iFlow builder series i
Flow builder series i
 
Tour to docgen lightning experience
Tour to docgen lightning experienceTour to docgen lightning experience
Tour to docgen lightning experience
 
DocuSign Power Form
DocuSign Power FormDocuSign Power Form
DocuSign Power Form
 
Multi language support for salesforce community portal
Multi language support for salesforce community portalMulti language support for salesforce community portal
Multi language support for salesforce community portal
 
Simplified appointment scheduling using lightning scheduler
Simplified appointment scheduling using lightning schedulerSimplified appointment scheduling using lightning scheduler
Simplified appointment scheduling using lightning scheduler
 
How to crack java script certification
How to crack java script certificationHow to crack java script certification
How to crack java script certification
 
Master tableau 20 in data science by solving real life analytics problems
Master tableau 20 in data science by solving real life analytics problemsMaster tableau 20 in data science by solving real life analytics problems
Master tableau 20 in data science by solving real life analytics problems
 
Low code love salesforce automation tool vs apex code
Low code love salesforce automation tool vs apex codeLow code love salesforce automation tool vs apex code
Low code love salesforce automation tool vs apex code
 
Qa mockup interview for automation testing
Qa mockup interview for automation testingQa mockup interview for automation testing
Qa mockup interview for automation testing
 
Qa mock up interview for manual testing
Qa mock up interview for manual testingQa mock up interview for manual testing
Qa mock up interview for manual testing
 
Docu sign integration with salesforce beginner learning series integration...
Docu sign integration with salesforce   beginner learning series  integration...Docu sign integration with salesforce   beginner learning series  integration...
Docu sign integration with salesforce beginner learning series integration...
 
Docu sign integration with salesforce beginner learning series setting up ...
Docu sign integration with salesforce   beginner learning series  setting up ...Docu sign integration with salesforce   beginner learning series  setting up ...
Docu sign integration with salesforce beginner learning series setting up ...
 
DocuSign Integration with Salesforce - Beginner Learning Series : Kick starti...
DocuSign Integration with Salesforce - Beginner Learning Series : Kick starti...DocuSign Integration with Salesforce - Beginner Learning Series : Kick starti...
DocuSign Integration with Salesforce - Beginner Learning Series : Kick starti...
 
Admin community meetup admin secrets to clear salesforce interview (1)
Admin community meetup   admin secrets to clear salesforce interview (1)Admin community meetup   admin secrets to clear salesforce interview (1)
Admin community meetup admin secrets to clear salesforce interview (1)
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 

Alternate for scheduled apex using flow builder

  • 1. Salesforce Admin Group, Trichy Alternate for Scheduled Apex using Flow Builder
  • 2. Kadhar Basha J Salesforce Admin Group, Trichy Trailblazer Community Group Leader MST Solutions Sundaravel J Salesforce Admin Group, Trichy Trailblazer Community Group Co-Leader MST Solutions Salesforce Admin Group, Trichy
  • 3. Salesforce Admin Group, Trichy Speaker Padmavathy T MST Solutions
  • 4. Today’s Agenda • What is a Schedule-Triggered Flow? • Things to Note • Apex Code - Example • Alternate Elements for Apex Code • Demo • Questions & Answers • Conclusion
  • 5. What is a Schedule-Triggered Flow? Logo • It is an auto-launched flow introduced in Winter’20 release • We can schedule it to start at a specific date and time • Different frequencies to run  Once  Daily  Weekly • Runs for each record in the batch and stores record’s field values in the $Record global variable. • Scheduled-Trigged Flow always runs in System mode.
  • 6. Things to Note Logo • The Start Time is based on the Salesforce org’s default time zone. • Start Time differs based on user’s time zone. • View All Data permission required. • Flow interviews per 24 hours is 2,50,000 • Flows are bulikfied • We can see debug of the scheduled flow in debug logs • We can track the number of records with the FLOW_START_SCHEDULED_RECORDS event
  • 7. Things to Note Logo • Deleting a schedule-triggered flow interview from the Scheduled Jobs, all future recurrences of that flow are cancelled. • Run as the Automated Process user. • Enable Filter inaccessible fields from flow requests in your org’s process automation settings. Otherwise, the flow fails because the Update Records element tries to set the values for system fields and other read-only fields. • Using multiple filters defaults to AND for different fields.
  • 8. Scenario Logo • Update: Tasks’ status to Auto-Closed • Condition: If open non-recurring tasks’ Due date passed 7 days • Schedule: Daily
  • 9. Apex Code Logo global class CloseTasks_AC implements Database.Batchable<sObject> { global Database.QueryLocator start(Database.BatchableContext BC) { String query = 'SELECT Id, Status, Due_Date_Passed__c, IsRecurrence FROM Task WHERE IsClosed = False AND Due_Date_Passed__c = True AND IsRecurrence = False'; return Database.getQueryLocator(query); } global void execute(Database.BatchableContext BC, List<Task> taskList){
  • 10. Apex Code Logo List<Task> tasks = new List<Task>(); if(taskList.size() > 0) { for(Task tsk : taskList) { tsk.Status = 'Auto-Closed'; tasks.add(tsk); } }
  • 11. Apex Code Logo if(tasks.size()>0) update taskList; } global void finish(Database.BatchableContext BC) { } }
  • 12. Alternate Elements for Apex Code Logo global Database.QueryLocator start(Database.BatchableContext BC) { String query = 'SELECT Id, Status, Due_Date_Passed__c, IsRecurrence FROM Task WHERE IsClosed = False AND Due_Date_Passed__c = True AND IsRecurrence = False'; return Database.getQueryLocator(query); }
  • 13. Alternate Elements for Apex Code Logo if(taskList.size() > 0) {}
  • 14. Alternate Elements for Apex Code Logo for(Task tsk : taskList) {}
  • 15. Alternate Elements for Apex Code Logo tsk.Status = 'Auto-Closed';
  • 16. Alternate Elements for Apex Code Logo List<Task> tasks = List<Task>(); .. .. newtasks.add(tsk);
  • 17. Alternate Elements for Apex Code Logo update taskList;
  • 18. Alternate Elements for Apex Code Logo Scheduling a flow using Apex, Anonymous window or CRON Expression or through Configuration
  • 20.
  • 21. Quiz Logo 1) A screen flow can be launched using a custom link. True False Ans: True. /flow/flow_Name 2) Schedule-Triggered flow can be scheduled monthly True False Ans: False
  • 22. Quiz Logo 3) Can we create formula to filter records in flow? Ans: No. We cannot directly create formula in flow. We can create a formula field and use it in the flow. 4) Can we change the datatype of the variable created in the flow? Ans: No
  • 23. Quiz Logo 5) Where can we find the scheduled flow interviews? Ans: Scheduled Jobs 6) What will happen when we delete the flow interviews of active flow in scheduled jobs? Ans: Future recurrences of that flow are cancelled. To enable future runs, deactivate and reactivate the flow.
  • 24. Quiz Logo 7) Which interface needs to be implemented in apex to be used in the flow? Ans: Using @InvocableMethod annotation with Static method 8) Where we can find all the elements used in the current flow? Ans: Manager tab in the left panel
  • 25. Quiz Logo 9) A flow is failing as it tries to update the system and read only fields. What you should do to get rid of this error? Ans: Enable “Filter inaccessible fields from flow requests” in your org’s process automation settings. 10) What will be the time zone for the date/time field values at run time? Ans: Values reflect the time zone settings of the running user
  • 26. Conclusion • New version of Flow contains all those options which is available after wrote a huge lines of code in Apex. • We are free from test classes. • Are you a low code lover, then you should proceed with the automation.