SlideShare a Scribd company logo
WELCOME!
SPEAKER
Custom Approval Process: A
Different Perspective
Why are we here today?
Our client had very complex and not finite requirements for Approval processes
• Dynamic rules for approving e.g. 2 of 3 approvals needed based on the context record details
• Make data updates in unrelated records
• Compute assignees on the fly
• Approval with a change (Amendment)
• Dynamically generate next Approval requests
• Pause/Unpause active approval process
• Highly configurable
This presentation outlines an idea for very customisable approvals framework addressing
the limitations of the standard approval process.
The proposed solution leverages Apex code stored within text fields and a custom
implementation of the EVAL method for Apex to provide dynamic approval/rejection
criteria and automate process progression, reducing the configuration overhead.
Seamlessly handles very complex custom scenarios such as determining completion
based on a specified percentage or number of approvals.
The Assigned Approvers can be computed dynamically at the time of the task
generation.
Highly configurable – ideal for Consultants with some Apex knowledge
Approach we took
ERD Approach
Process Definition
(ContextObject, EntryCriteria)
Process Node
(StepId, EntryCriteria)
Process Node
(StepId, EntryCriteria)
ERD Approach
ProcessInstance
(ContextObjectRecordId, Status)
ProcessInstanceNode
(StepStatus, CompletionDate)
ProcessInstanceNode
(StepStatus, Completiondate)
ProcessInstanceWork
Item (Actor, Status)
ProcessInstanceWork
Item (Actor, Status)
ProcessInstanceWork
Item (Actor, Status)
ERD
eval in Apex
It should be noted that using executeAnonymous won't execute in the same context the way the Javascript eval() does. Any inputs need to be
explicitly included in the Apex string to execute.
Also, any return values need to be returned via the log and then parsed out to bring them into the context of the calling Apex.
Programmatic evaluation of Apex string and extraction of the result using executeAnonymous API call
- ExecuteAnonymous call is available through Apex API & Tooling API.
We use the Apex API – we can add debugging header (<apex:DebuggingHeader>) in request to get log in response and then parse that
response to get the result.
1. Build up the anonymous Apex string including any required inputs.
Use a System.debug(LoggingLevel.Error, 'output here') to send back the output data.
2. Call the Apex API executeAnonymous web method
3. Capture the DebuggingInfo SOAP header in the response and Parse the USER_DEBUG Error message out of the Apex Log.
4. Convert the resulting string to the target data type if required.
Framework
eval()
Core methods
Public methods
Workflow
configuration Public methods
submit(processDefinition,contextRecord) {
String errorMessage = WF_helper.checkEntryCriteria(processDefinition, contextRecord);
If(String.isBlank(errorMessage)) { //start process instance, compute first stepid, activate
node with that stepid and create workitems/approval requests}
}
Workflow Core methods
String contextRecordString = 'Account record = [SELECT Id, Industry FROM Account WHERE Id =' '+
contextRecord.Id + ''];';
String configScript = processDefinition.EntryCriteria__c;
String toEval = contextRecordString;
toEval += 'String result = '';';
toEval += configScript;
toEval += 'System.debug(LoggingLevelError, result);';
String finalResult = WF_ExecuteAnonymousApex.eval(toEval);
return finalResult;
Final String with code used by eval()
Account record = [SELECT Id, Industry FROM Account WHERE Id ='<accountId>'];
String result = record.Industry == 'Finance' ? '':'Criteria doesn't match';
System.debug(LoggingLevel.Error, result);
Workflow Configuration
processDefinition's EntryCriteria__c field value is the below string
result = record.Industry == 'Finance' ? '':'Criteria doesn't match';
Framework
ExecuteAnonymous API call
String endpoint = URL.getSalesforceBaseUrl().toExternalForm() + '/services/Soap/s/56.0';
HttpRequest req = new HttpRequest();
req.setEndpoint(endpoint_x);
req.setMethod('POST');
req.setHeader('Content-Type', 'text/xml; charset=UTF-8');
req.setHeader('SOAPAction', 'blank');
req.setBodyDocument(doc);
Http http = new Http();
HTTPResponse res = http.send(req);
return extractDebugLog(res.getBodyDocument());
Request Body
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:apex="http://soap.sforce.com/2006/08/apex">
<soapenv:Header>
<apex:DebuggingHeader>
<apex:categories>
<apex:category>Apex_code</apex:category>
<apex:level>ERROR</apex:level>
</apex:categories>
<apex:debugLevel>NONE</apex:debugLevel>
</apex:DebuggingHeader>
<apex:SessionHeader>
<apex:sessionId>Session Id</apex:sessionId>
</apex:SessionHeader>
</soapenv:Header>
<soapenv:Body>
<apex:executeAnonymous>
<apex:String>Final string of code;</apex:String>
</apex:executeAnonymous>
</soapenv:Body>
</soapenv:Envelope>
Final String with code
Account record = [SELECT Id, Industry FROM Account WHERE Id ='<accountId>'];
String result = record.Industry == 'Finance' ? '':'Criteria doesn't match';
System.debug(LoggingLevel.Error, result);
Response
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/..."
<soapenv:Header>
<DebuggingInfo>
<debugLog>31.0 APEX_CODE,ERROR
Execute Anonymous: Final string of code
13:24:24.027 (27564504)|EXECUTION_STARTED
13:24:24.027 (27573409)|CODE_UNIT_STARTED|[EXTERNAL]|execute_anonymous_apex
13:24:24.028 (28065096)|USER_DEBUG|[1]|ERROR| Actual Output ("" or Criteria doesn't
match)
13:24:24.028 (28098385)|CODE_UNIT_FINISHED|execute_anonymous_apex
13:24:24.029 (29024086)|EXECUTION_FINISHED</debugLog>
</DebuggingInfo>
</soapenv:Header>
<soapenv:Body>
<executeAnonymousResponse>
<result>
<column>-1</column>
<compileProblem xsi:nil="true"/>
<compiled>true</compiled>
<exceptionMessage xsi:nil="true"/>
<exceptionStackTrace xsi:nil="true"/>
<line>-1</line>
<success>true</success>
</result>
</executeAnonymousResponse>
</soapenv:Body>
</soapenv:Envelope>
Workfow Configuration
Process Configuration Samples
Scenario
Developers which are employees of a company and they have been contracted to
work on a project for a client.
When they want to go on an annual leave, they need to get an approval from both,
their own direct managers (Line, Delivery and Division Manager) and the client's
project manager.
Rules
• At least 50% of their Employer direct Managers needs to approve, e.g. 2 of 3
managers.
Once 50% was achieved the approval is given and the process can continue.
• Then a Project Manager on the Client side needs to approve as well, but only if
the Developer is currently assigned to a project.
Process Execution - Submission
AFTER SUBMISSION ACTION
After Submission Sample
Map<String, List<User>> roleToUsersMap = WF_Actors.getRoleUsers(contextRecordId,
new List<String> {'Line Manager', 'Delivery Manager', 'Division Manager'});
List<WF_App_Actions.RequestParams> requestParamsList = new List<WF_App_Actions.RequestParams>();
for (String role : roleToUsersMap.keySet()) {
for (User assignee : roleToUsersMap.get(role)) {
requestParamsList.add(new WF_App_Actions.RequestParams(
'Approve - ' + role,
'Select 'Approve' if you are happy to approve the leave.',
assignee, role, null));
}
}
}
WF_App_Actions.createApproverRequest(processInstanceId, processInstanceNodeId, requestParamsList);
IS FINAL APPROVAL – FRAMEWORK CODE
After Approval Sample
public static Boolean checkIfFinalApproval(
Id processInstanceNodeId,
Integer percentageRequired)
completedApprovals = Integer.valueOf(
processInstanceNode.NumberOfApprovals__c);
Integer allApprovals = [SELECT Count()
FROM WF_ProcessInstanceWorkItem__c
WHERE processInstanceNode =: processInstanceNodeId];
return (completedApprovals/allApprovals*100) >= percentageRequired;
// When 50% percentage required
result = WF_App_Actions.checkIfFinalApproval(processInstanceNodeId,
50);
result = ourHR.hasActiveProject(contextRecord.RequestedBy__c ? '002' : null;
APPROVED NEXT STEP ID
Map<String, List<User>> roleToUsersMap = LeaveApproval.getRoleUsers(contextRecordId,
new List<String> {'Project Manager'});
If (roleToUsersMap.size() == 0) return; // Finish the step when user has no Project Manager
List<WF_App_Actions.RequestParams> requestParamsList =
new List<WF_App_Actions.RequestParams>();
for (String role : roleToUsersMap.keySet()) {
for (User assignee : roleToUsersMap.get(role)) {
requestParamsList.add(new WF_App_Actions.RequestParams(
'Approve a leave request', 'Select 'Approve' if you are happy to approve,
assignee, role, null, null, false))
}
}
WF_App_Actions.createApproverRequest(processInstanceId, nextProcessInstanceNodeId,
requestParamsList);
AFTER FINAL APPROVAL ACTION
IS FINAL APPROVAL - CONFIGURATION
Implementation highlights
Topic Solution Approach
Executing anonymous apex script runs as the running user, not in system mode,
and if the script need to refer to any Apex classes to invoke methods, we would
need to grant the users permissions that we wouldn’t want to, such as Author Apex
or access to Setup
Using Named Credential to authenticate and login as an admin user.
With Named Credentials, we can provide the callout with admin credentials so the
dynamic code can be executed with as much flexibility as our written code. The
Named Credential takes in the URL of the callout we want to make and the necessary
authentication credentials for a User. When the callout is being made, those
credentials are used to authenticate and perform the callout.
Executing anonymous Apex script relies on making a callout, and we need to avoid
the error of ‘uncommitted changes in transaction…' whenever trying to make a
callout after any DMLs within the same transaction
We execute the Apex script in a future call.
Configuration details - All configs are saved in custom object records like
ProcessDef, Process Node etc.
We need a way to migrate these records across orgs and as well make them
available for unit tests
Fetch the records and save them as CSVs and upload them as static resources. The
static resources can be migrated from one org to another using source control system.
We can then have a command line data loader or an Apex class to read static
resources and load records.
Q&A
• Our article about the Approvals
Custom Approval Process: A Different Perspective | Bluewave (bluewavecx.com) - https://bit.ly/44HalH4
• Thanks to Kevin Poorman
https://codefriar.wordpress.com/2014/10/30/eval-in-apex-secure-dynamic-code-evaluation-on-the-
salesforce1-platform/
• And Daniel Ballinger
https://www.fishofprey.com/2014/11/adding-eval-support-to-apex.html
Resources
THANK YOU!

More Related Content

Similar to Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder

How to perform debounce in react
How to perform debounce in reactHow to perform debounce in react
How to perform debounce in react
BOSC Tech Labs
 
Sherlock holmes for dba’s
Sherlock holmes for dba’sSherlock holmes for dba’s
Sherlock holmes for dba’s
Kellyn Pot'Vin-Gorman
 
Msql
Msql Msql
Msql
ksujitha
 
Change tracking
Change trackingChange tracking
Change tracking
Sonny56
 
Spring AOP @ DevClub.eu
Spring AOP @ DevClub.euSpring AOP @ DevClub.eu
Spring AOP @ DevClub.eu
arsenikum
 
JDBC Connecticity.ppt
JDBC Connecticity.pptJDBC Connecticity.ppt
JDBC Connecticity.ppt
Swapnil Kale
 
Module04
Module04Module04
Module04
Sridhar P
 
Procedures/functions of rdbms
Procedures/functions of rdbmsProcedures/functions of rdbms
Procedures/functions of rdbms
jain.pralabh
 
Refactoring @ Mindvalley: Smells, Techniques and Patterns
Refactoring @ Mindvalley: Smells, Techniques and PatternsRefactoring @ Mindvalley: Smells, Techniques and Patterns
Refactoring @ Mindvalley: Smells, Techniques and Patterns
Tristan Gomez
 
RightScale API: How To Build Your Own IT Vending Machine - RightScale Compute...
RightScale API: How To Build Your Own IT Vending Machine - RightScale Compute...RightScale API: How To Build Your Own IT Vending Machine - RightScale Compute...
RightScale API: How To Build Your Own IT Vending Machine - RightScale Compute...
RightScale
 
What's Coming in Spring 3.0
What's Coming in Spring 3.0What's Coming in Spring 3.0
What's Coming in Spring 3.0
Matt Raible
 
Developers' New features of Sql server express 2012
Developers' New features of Sql server express 2012Developers' New features of Sql server express 2012
Developers' New features of Sql server express 2012
Ziaur Rahman
 
Subqueries views stored procedures_triggers_transactions
Subqueries views stored procedures_triggers_transactionsSubqueries views stored procedures_triggers_transactions
Subqueries views stored procedures_triggers_transactions
maxpane
 
lecture13.ppt
lecture13.pptlecture13.ppt
lecture13.ppt
IrfanAkbar35
 
Asynchronous Apex Salesforce World Tour Paris 2015
Asynchronous Apex Salesforce World Tour Paris 2015Asynchronous Apex Salesforce World Tour Paris 2015
Asynchronous Apex Salesforce World Tour Paris 2015
Samuel De Rycke
 
stored.ppt
stored.pptstored.ppt
Asp.Net Ajax Component Development
Asp.Net Ajax Component DevelopmentAsp.Net Ajax Component Development
Asp.Net Ajax Component Development
Chui-Wen Chiu
 
QQ And Advance Query
QQ And Advance QueryQQ And Advance Query
QQ And Advance Query
Kai Liu
 
Intro to Laravel 4
Intro to Laravel 4Intro to Laravel 4
Intro to Laravel 4
Singapore PHP User Group
 
Stored procedures
Stored proceduresStored procedures
Stored procedures
Prof.Nilesh Magar
 

Similar to Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder (20)

How to perform debounce in react
How to perform debounce in reactHow to perform debounce in react
How to perform debounce in react
 
Sherlock holmes for dba’s
Sherlock holmes for dba’sSherlock holmes for dba’s
Sherlock holmes for dba’s
 
Msql
Msql Msql
Msql
 
Change tracking
Change trackingChange tracking
Change tracking
 
Spring AOP @ DevClub.eu
Spring AOP @ DevClub.euSpring AOP @ DevClub.eu
Spring AOP @ DevClub.eu
 
JDBC Connecticity.ppt
JDBC Connecticity.pptJDBC Connecticity.ppt
JDBC Connecticity.ppt
 
Module04
Module04Module04
Module04
 
Procedures/functions of rdbms
Procedures/functions of rdbmsProcedures/functions of rdbms
Procedures/functions of rdbms
 
Refactoring @ Mindvalley: Smells, Techniques and Patterns
Refactoring @ Mindvalley: Smells, Techniques and PatternsRefactoring @ Mindvalley: Smells, Techniques and Patterns
Refactoring @ Mindvalley: Smells, Techniques and Patterns
 
RightScale API: How To Build Your Own IT Vending Machine - RightScale Compute...
RightScale API: How To Build Your Own IT Vending Machine - RightScale Compute...RightScale API: How To Build Your Own IT Vending Machine - RightScale Compute...
RightScale API: How To Build Your Own IT Vending Machine - RightScale Compute...
 
What's Coming in Spring 3.0
What's Coming in Spring 3.0What's Coming in Spring 3.0
What's Coming in Spring 3.0
 
Developers' New features of Sql server express 2012
Developers' New features of Sql server express 2012Developers' New features of Sql server express 2012
Developers' New features of Sql server express 2012
 
Subqueries views stored procedures_triggers_transactions
Subqueries views stored procedures_triggers_transactionsSubqueries views stored procedures_triggers_transactions
Subqueries views stored procedures_triggers_transactions
 
lecture13.ppt
lecture13.pptlecture13.ppt
lecture13.ppt
 
Asynchronous Apex Salesforce World Tour Paris 2015
Asynchronous Apex Salesforce World Tour Paris 2015Asynchronous Apex Salesforce World Tour Paris 2015
Asynchronous Apex Salesforce World Tour Paris 2015
 
stored.ppt
stored.pptstored.ppt
stored.ppt
 
Asp.Net Ajax Component Development
Asp.Net Ajax Component DevelopmentAsp.Net Ajax Component Development
Asp.Net Ajax Component Development
 
QQ And Advance Query
QQ And Advance QueryQQ And Advance Query
QQ And Advance Query
 
Intro to Laravel 4
Intro to Laravel 4Intro to Laravel 4
Intro to Laravel 4
 
Stored procedures
Stored proceduresStored procedures
Stored procedures
 

More from CzechDreamin

10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
CzechDreamin
 
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
CzechDreamin
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
CzechDreamin
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
CzechDreamin
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara Laskowska
CzechDreamin
 
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeFree and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
CzechDreamin
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří Karpíšek
CzechDreamin
 
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
CzechDreamin
 
Salesforce Forecasting: Evolution, Implementation and Best Practices, Christi...
Salesforce Forecasting: Evolution, Implementation and Best Practices, Christi...Salesforce Forecasting: Evolution, Implementation and Best Practices, Christi...
Salesforce Forecasting: Evolution, Implementation and Best Practices, Christi...
CzechDreamin
 
Supercharge Salesforce Marketing Cloud: The Ultimate Apps Guide, Cyril Louis ...
Supercharge Salesforce Marketing Cloud: The Ultimate Apps Guide, Cyril Louis ...Supercharge Salesforce Marketing Cloud: The Ultimate Apps Guide, Cyril Louis ...
Supercharge Salesforce Marketing Cloud: The Ultimate Apps Guide, Cyril Louis ...
CzechDreamin
 
How we should include Devops Center to get happy developers?, David Fernandez...
How we should include Devops Center to get happy developers?, David Fernandez...How we should include Devops Center to get happy developers?, David Fernandez...
How we should include Devops Center to get happy developers?, David Fernandez...
CzechDreamin
 
Streamline Your Integration with Salesforce’s Composite API: A Consultant’s G...
Streamline Your Integration with Salesforce’s Composite API: A Consultant’s G...Streamline Your Integration with Salesforce’s Composite API: A Consultant’s G...
Streamline Your Integration with Salesforce’s Composite API: A Consultant’s G...
CzechDreamin
 
Architecting for Analytics, Aaron Crear
Architecting for Analytics, Aaron CrearArchitecting for Analytics, Aaron Crear
Architecting for Analytics, Aaron Crear
CzechDreamin
 
Ape to API, Filip Dousek
Ape to API, Filip DousekApe to API, Filip Dousek
Ape to API, Filip Dousek
CzechDreamin
 
Push Upgrades, The last mile of Salesforce DevOps, Manuel Moya
Push Upgrades, The last mile of Salesforce DevOps, Manuel MoyaPush Upgrades, The last mile of Salesforce DevOps, Manuel Moya
Push Upgrades, The last mile of Salesforce DevOps, Manuel Moya
CzechDreamin
 
How do you know you’re solving the right problem? Design Thinking for Salesfo...
How do you know you’re solving the right problem? Design Thinking for Salesfo...How do you know you’re solving the right problem? Design Thinking for Salesfo...
How do you know you’re solving the right problem? Design Thinking for Salesfo...
CzechDreamin
 
ChatGPT … How Does it Flow?, Mark Jones
ChatGPT … How Does it Flow?, Mark JonesChatGPT … How Does it Flow?, Mark Jones
ChatGPT … How Does it Flow?, Mark Jones
CzechDreamin
 
Real-time communication with Account Engagement (Pardot). Marketers meet deve...
Real-time communication with Account Engagement (Pardot). Marketers meet deve...Real-time communication with Account Engagement (Pardot). Marketers meet deve...
Real-time communication with Account Engagement (Pardot). Marketers meet deve...
CzechDreamin
 
Black Hat Session: Exploring and Exploiting Aura based Experiences, Christian...
Black Hat Session: Exploring and Exploiting Aura based Experiences, Christian...Black Hat Session: Exploring and Exploiting Aura based Experiences, Christian...
Black Hat Session: Exploring and Exploiting Aura based Experiences, Christian...
CzechDreamin
 
Sales methodology for Salesforce Opportunity, Georgy Avilov
Sales methodology for Salesforce Opportunity, Georgy AvilovSales methodology for Salesforce Opportunity, Georgy Avilov
Sales methodology for Salesforce Opportunity, Georgy Avilov
CzechDreamin
 

More from CzechDreamin (20)

10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
 
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara Laskowska
 
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeFree and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří Karpíšek
 
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
 
Salesforce Forecasting: Evolution, Implementation and Best Practices, Christi...
Salesforce Forecasting: Evolution, Implementation and Best Practices, Christi...Salesforce Forecasting: Evolution, Implementation and Best Practices, Christi...
Salesforce Forecasting: Evolution, Implementation and Best Practices, Christi...
 
Supercharge Salesforce Marketing Cloud: The Ultimate Apps Guide, Cyril Louis ...
Supercharge Salesforce Marketing Cloud: The Ultimate Apps Guide, Cyril Louis ...Supercharge Salesforce Marketing Cloud: The Ultimate Apps Guide, Cyril Louis ...
Supercharge Salesforce Marketing Cloud: The Ultimate Apps Guide, Cyril Louis ...
 
How we should include Devops Center to get happy developers?, David Fernandez...
How we should include Devops Center to get happy developers?, David Fernandez...How we should include Devops Center to get happy developers?, David Fernandez...
How we should include Devops Center to get happy developers?, David Fernandez...
 
Streamline Your Integration with Salesforce’s Composite API: A Consultant’s G...
Streamline Your Integration with Salesforce’s Composite API: A Consultant’s G...Streamline Your Integration with Salesforce’s Composite API: A Consultant’s G...
Streamline Your Integration with Salesforce’s Composite API: A Consultant’s G...
 
Architecting for Analytics, Aaron Crear
Architecting for Analytics, Aaron CrearArchitecting for Analytics, Aaron Crear
Architecting for Analytics, Aaron Crear
 
Ape to API, Filip Dousek
Ape to API, Filip DousekApe to API, Filip Dousek
Ape to API, Filip Dousek
 
Push Upgrades, The last mile of Salesforce DevOps, Manuel Moya
Push Upgrades, The last mile of Salesforce DevOps, Manuel MoyaPush Upgrades, The last mile of Salesforce DevOps, Manuel Moya
Push Upgrades, The last mile of Salesforce DevOps, Manuel Moya
 
How do you know you’re solving the right problem? Design Thinking for Salesfo...
How do you know you’re solving the right problem? Design Thinking for Salesfo...How do you know you’re solving the right problem? Design Thinking for Salesfo...
How do you know you’re solving the right problem? Design Thinking for Salesfo...
 
ChatGPT … How Does it Flow?, Mark Jones
ChatGPT … How Does it Flow?, Mark JonesChatGPT … How Does it Flow?, Mark Jones
ChatGPT … How Does it Flow?, Mark Jones
 
Real-time communication with Account Engagement (Pardot). Marketers meet deve...
Real-time communication with Account Engagement (Pardot). Marketers meet deve...Real-time communication with Account Engagement (Pardot). Marketers meet deve...
Real-time communication with Account Engagement (Pardot). Marketers meet deve...
 
Black Hat Session: Exploring and Exploiting Aura based Experiences, Christian...
Black Hat Session: Exploring and Exploiting Aura based Experiences, Christian...Black Hat Session: Exploring and Exploiting Aura based Experiences, Christian...
Black Hat Session: Exploring and Exploiting Aura based Experiences, Christian...
 
Sales methodology for Salesforce Opportunity, Georgy Avilov
Sales methodology for Salesforce Opportunity, Georgy AvilovSales methodology for Salesforce Opportunity, Georgy Avilov
Sales methodology for Salesforce Opportunity, Georgy Avilov
 

Recently uploaded

PRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptxPRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
christinelarrosa
 
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
Alex Pruden
 
"$10 thousand per minute of downtime: architecture, queues, streaming and fin...
"$10 thousand per minute of downtime: architecture, queues, streaming and fin..."$10 thousand per minute of downtime: architecture, queues, streaming and fin...
"$10 thousand per minute of downtime: architecture, queues, streaming and fin...
Fwdays
 
Mutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented ChatbotsMutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented Chatbots
Pablo Gómez Abajo
 
Essentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation ParametersEssentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation Parameters
Safe Software
 
JavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green MasterplanJavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green Masterplan
Miro Wengner
 
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham HillinQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
LizaNolte
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
Chart Kalyan
 
Principle of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptxPrinciple of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptx
BibashShahi
 
The Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptxThe Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptx
operationspcvita
 
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
Edge AI and Vision Alliance
 
QA or the Highway - Component Testing: Bridging the gap between frontend appl...
QA or the Highway - Component Testing: Bridging the gap between frontend appl...QA or the Highway - Component Testing: Bridging the gap between frontend appl...
QA or the Highway - Component Testing: Bridging the gap between frontend appl...
zjhamm304
 
AppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSFAppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSF
Ajin Abraham
 
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving
 
"What does it really mean for your system to be available, or how to define w...
"What does it really mean for your system to be available, or how to define w..."What does it really mean for your system to be available, or how to define w...
"What does it really mean for your system to be available, or how to define w...
Fwdays
 
"NATO Hackathon Winner: AI-Powered Drug Search", Taras Kloba
"NATO Hackathon Winner: AI-Powered Drug Search",  Taras Kloba"NATO Hackathon Winner: AI-Powered Drug Search",  Taras Kloba
"NATO Hackathon Winner: AI-Powered Drug Search", Taras Kloba
Fwdays
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
MichaelKnudsen27
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 
"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota
Fwdays
 
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
DanBrown980551
 

Recently uploaded (20)

PRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptxPRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
 
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
 
"$10 thousand per minute of downtime: architecture, queues, streaming and fin...
"$10 thousand per minute of downtime: architecture, queues, streaming and fin..."$10 thousand per minute of downtime: architecture, queues, streaming and fin...
"$10 thousand per minute of downtime: architecture, queues, streaming and fin...
 
Mutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented ChatbotsMutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented Chatbots
 
Essentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation ParametersEssentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation Parameters
 
JavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green MasterplanJavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green Masterplan
 
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham HillinQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
 
Principle of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptxPrinciple of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptx
 
The Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptxThe Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptx
 
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
 
QA or the Highway - Component Testing: Bridging the gap between frontend appl...
QA or the Highway - Component Testing: Bridging the gap between frontend appl...QA or the Highway - Component Testing: Bridging the gap between frontend appl...
QA or the Highway - Component Testing: Bridging the gap between frontend appl...
 
AppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSFAppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSF
 
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024
 
"What does it really mean for your system to be available, or how to define w...
"What does it really mean for your system to be available, or how to define w..."What does it really mean for your system to be available, or how to define w...
"What does it really mean for your system to be available, or how to define w...
 
"NATO Hackathon Winner: AI-Powered Drug Search", Taras Kloba
"NATO Hackathon Winner: AI-Powered Drug Search",  Taras Kloba"NATO Hackathon Winner: AI-Powered Drug Search",  Taras Kloba
"NATO Hackathon Winner: AI-Powered Drug Search", Taras Kloba
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 
"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota
 
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
 

Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder

  • 2. SPEAKER Custom Approval Process: A Different Perspective
  • 3. Why are we here today? Our client had very complex and not finite requirements for Approval processes • Dynamic rules for approving e.g. 2 of 3 approvals needed based on the context record details • Make data updates in unrelated records • Compute assignees on the fly • Approval with a change (Amendment) • Dynamically generate next Approval requests • Pause/Unpause active approval process • Highly configurable
  • 4. This presentation outlines an idea for very customisable approvals framework addressing the limitations of the standard approval process. The proposed solution leverages Apex code stored within text fields and a custom implementation of the EVAL method for Apex to provide dynamic approval/rejection criteria and automate process progression, reducing the configuration overhead. Seamlessly handles very complex custom scenarios such as determining completion based on a specified percentage or number of approvals. The Assigned Approvers can be computed dynamically at the time of the task generation. Highly configurable – ideal for Consultants with some Apex knowledge Approach we took
  • 5. ERD Approach Process Definition (ContextObject, EntryCriteria) Process Node (StepId, EntryCriteria) Process Node (StepId, EntryCriteria)
  • 6. ERD Approach ProcessInstance (ContextObjectRecordId, Status) ProcessInstanceNode (StepStatus, CompletionDate) ProcessInstanceNode (StepStatus, Completiondate) ProcessInstanceWork Item (Actor, Status) ProcessInstanceWork Item (Actor, Status) ProcessInstanceWork Item (Actor, Status)
  • 7. ERD
  • 8. eval in Apex It should be noted that using executeAnonymous won't execute in the same context the way the Javascript eval() does. Any inputs need to be explicitly included in the Apex string to execute. Also, any return values need to be returned via the log and then parsed out to bring them into the context of the calling Apex. Programmatic evaluation of Apex string and extraction of the result using executeAnonymous API call - ExecuteAnonymous call is available through Apex API & Tooling API. We use the Apex API – we can add debugging header (<apex:DebuggingHeader>) in request to get log in response and then parse that response to get the result. 1. Build up the anonymous Apex string including any required inputs. Use a System.debug(LoggingLevel.Error, 'output here') to send back the output data. 2. Call the Apex API executeAnonymous web method 3. Capture the DebuggingInfo SOAP header in the response and Parse the USER_DEBUG Error message out of the Apex Log. 4. Convert the resulting string to the target data type if required.
  • 9. Framework eval() Core methods Public methods Workflow configuration Public methods submit(processDefinition,contextRecord) { String errorMessage = WF_helper.checkEntryCriteria(processDefinition, contextRecord); If(String.isBlank(errorMessage)) { //start process instance, compute first stepid, activate node with that stepid and create workitems/approval requests} } Workflow Core methods String contextRecordString = 'Account record = [SELECT Id, Industry FROM Account WHERE Id =' '+ contextRecord.Id + ''];'; String configScript = processDefinition.EntryCriteria__c; String toEval = contextRecordString; toEval += 'String result = '';'; toEval += configScript; toEval += 'System.debug(LoggingLevelError, result);'; String finalResult = WF_ExecuteAnonymousApex.eval(toEval); return finalResult; Final String with code used by eval() Account record = [SELECT Id, Industry FROM Account WHERE Id ='<accountId>']; String result = record.Industry == 'Finance' ? '':'Criteria doesn't match'; System.debug(LoggingLevel.Error, result); Workflow Configuration processDefinition's EntryCriteria__c field value is the below string result = record.Industry == 'Finance' ? '':'Criteria doesn't match';
  • 10. Framework ExecuteAnonymous API call String endpoint = URL.getSalesforceBaseUrl().toExternalForm() + '/services/Soap/s/56.0'; HttpRequest req = new HttpRequest(); req.setEndpoint(endpoint_x); req.setMethod('POST'); req.setHeader('Content-Type', 'text/xml; charset=UTF-8'); req.setHeader('SOAPAction', 'blank'); req.setBodyDocument(doc); Http http = new Http(); HTTPResponse res = http.send(req); return extractDebugLog(res.getBodyDocument()); Request Body <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:apex="http://soap.sforce.com/2006/08/apex"> <soapenv:Header> <apex:DebuggingHeader> <apex:categories> <apex:category>Apex_code</apex:category> <apex:level>ERROR</apex:level> </apex:categories> <apex:debugLevel>NONE</apex:debugLevel> </apex:DebuggingHeader> <apex:SessionHeader> <apex:sessionId>Session Id</apex:sessionId> </apex:SessionHeader> </soapenv:Header> <soapenv:Body> <apex:executeAnonymous> <apex:String>Final string of code;</apex:String> </apex:executeAnonymous> </soapenv:Body> </soapenv:Envelope> Final String with code Account record = [SELECT Id, Industry FROM Account WHERE Id ='<accountId>']; String result = record.Industry == 'Finance' ? '':'Criteria doesn't match'; System.debug(LoggingLevel.Error, result); Response <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/..." <soapenv:Header> <DebuggingInfo> <debugLog>31.0 APEX_CODE,ERROR Execute Anonymous: Final string of code 13:24:24.027 (27564504)|EXECUTION_STARTED 13:24:24.027 (27573409)|CODE_UNIT_STARTED|[EXTERNAL]|execute_anonymous_apex 13:24:24.028 (28065096)|USER_DEBUG|[1]|ERROR| Actual Output ("" or Criteria doesn't match) 13:24:24.028 (28098385)|CODE_UNIT_FINISHED|execute_anonymous_apex 13:24:24.029 (29024086)|EXECUTION_FINISHED</debugLog> </DebuggingInfo> </soapenv:Header> <soapenv:Body> <executeAnonymousResponse> <result> <column>-1</column> <compileProblem xsi:nil="true"/> <compiled>true</compiled> <exceptionMessage xsi:nil="true"/> <exceptionStackTrace xsi:nil="true"/> <line>-1</line> <success>true</success> </result> </executeAnonymousResponse> </soapenv:Body> </soapenv:Envelope>
  • 12. Process Configuration Samples Scenario Developers which are employees of a company and they have been contracted to work on a project for a client. When they want to go on an annual leave, they need to get an approval from both, their own direct managers (Line, Delivery and Division Manager) and the client's project manager. Rules • At least 50% of their Employer direct Managers needs to approve, e.g. 2 of 3 managers. Once 50% was achieved the approval is given and the process can continue. • Then a Project Manager on the Client side needs to approve as well, but only if the Developer is currently assigned to a project.
  • 13. Process Execution - Submission
  • 14. AFTER SUBMISSION ACTION After Submission Sample Map<String, List<User>> roleToUsersMap = WF_Actors.getRoleUsers(contextRecordId, new List<String> {'Line Manager', 'Delivery Manager', 'Division Manager'}); List<WF_App_Actions.RequestParams> requestParamsList = new List<WF_App_Actions.RequestParams>(); for (String role : roleToUsersMap.keySet()) { for (User assignee : roleToUsersMap.get(role)) { requestParamsList.add(new WF_App_Actions.RequestParams( 'Approve - ' + role, 'Select 'Approve' if you are happy to approve the leave.', assignee, role, null)); } } } WF_App_Actions.createApproverRequest(processInstanceId, processInstanceNodeId, requestParamsList);
  • 15. IS FINAL APPROVAL – FRAMEWORK CODE After Approval Sample public static Boolean checkIfFinalApproval( Id processInstanceNodeId, Integer percentageRequired) completedApprovals = Integer.valueOf( processInstanceNode.NumberOfApprovals__c); Integer allApprovals = [SELECT Count() FROM WF_ProcessInstanceWorkItem__c WHERE processInstanceNode =: processInstanceNodeId]; return (completedApprovals/allApprovals*100) >= percentageRequired; // When 50% percentage required result = WF_App_Actions.checkIfFinalApproval(processInstanceNodeId, 50); result = ourHR.hasActiveProject(contextRecord.RequestedBy__c ? '002' : null; APPROVED NEXT STEP ID Map<String, List<User>> roleToUsersMap = LeaveApproval.getRoleUsers(contextRecordId, new List<String> {'Project Manager'}); If (roleToUsersMap.size() == 0) return; // Finish the step when user has no Project Manager List<WF_App_Actions.RequestParams> requestParamsList = new List<WF_App_Actions.RequestParams>(); for (String role : roleToUsersMap.keySet()) { for (User assignee : roleToUsersMap.get(role)) { requestParamsList.add(new WF_App_Actions.RequestParams( 'Approve a leave request', 'Select 'Approve' if you are happy to approve, assignee, role, null, null, false)) } } WF_App_Actions.createApproverRequest(processInstanceId, nextProcessInstanceNodeId, requestParamsList); AFTER FINAL APPROVAL ACTION IS FINAL APPROVAL - CONFIGURATION
  • 16. Implementation highlights Topic Solution Approach Executing anonymous apex script runs as the running user, not in system mode, and if the script need to refer to any Apex classes to invoke methods, we would need to grant the users permissions that we wouldn’t want to, such as Author Apex or access to Setup Using Named Credential to authenticate and login as an admin user. With Named Credentials, we can provide the callout with admin credentials so the dynamic code can be executed with as much flexibility as our written code. The Named Credential takes in the URL of the callout we want to make and the necessary authentication credentials for a User. When the callout is being made, those credentials are used to authenticate and perform the callout. Executing anonymous Apex script relies on making a callout, and we need to avoid the error of ‘uncommitted changes in transaction…' whenever trying to make a callout after any DMLs within the same transaction We execute the Apex script in a future call. Configuration details - All configs are saved in custom object records like ProcessDef, Process Node etc. We need a way to migrate these records across orgs and as well make them available for unit tests Fetch the records and save them as CSVs and upload them as static resources. The static resources can be migrated from one org to another using source control system. We can then have a command line data loader or an Apex class to read static resources and load records.
  • 17. Q&A
  • 18. • Our article about the Approvals Custom Approval Process: A Different Perspective | Bluewave (bluewavecx.com) - https://bit.ly/44HalH4 • Thanks to Kevin Poorman https://codefriar.wordpress.com/2014/10/30/eval-in-apex-secure-dynamic-code-evaluation-on-the- salesforce1-platform/ • And Daniel Ballinger https://www.fishofprey.com/2014/11/adding-eval-support-to-apex.html Resources

Editor's Notes

  1. https://drive.google.com/file/d/1QsPWui12iN2Lyz_kknYiNzQxGBwTrsqX/view?usp=sharing Redo in landscape mode
  2. With the tooling API the Apex debug log is generated but needs to be queried separately from the ApexLog. Thanks to Kevin Poorman (https://codefriar.wordpress.com/2014/10/30/eval-in-apex-secure-dynamic-code-evaluation-on-the-salesforce1-platform/) And Daniel Ballinger (https://www.fishofprey.com/2014/11/adding-eval-support-to-apex.html)
  3. Need to simplify and rearrange the boxes
  4. e.g. the PM is a field on the related Project object via a junction object
  5. HR records for employees related to supervisors with roles (not SF Roles) public class RequestParams { public String title = ''; //example: Review Draft LOI public String requestMessage = ''; //  public String chatterMessage; // The message to override the default message for chatter feed. public User assignee; // User ID of the actor public String assigneeQueue; // Developer name of the Queue public String assigneeRole = ''; // example: Pricing Manager public String availableStepIds; // Comma-separated list of StepIds that the WorkItem can be transferred to
  6. For instance when we are calling the After Submission Action. Because this is done asynchronously, we might face timing related issues such as after submitting a workflow, work items are only created later on and we may need an extra refresh of the page or components to register the work items creation or whatever effect done in the apex script.