-
Write each step of the flow in pseudocode before attempting to implement the flow itself. It's easier to change things at this stage and breakdown the flow into chunks and possible subflows.
-
Identify fixed (or hardcoded) values and turn them into inputs for a process builder (if run-as a background process) or into inputs passed by apex class (if run-as a user facing flow). This makes the testing process easier since you can pass your own test accounts IDs and other random values for debugging.
-
Validate user inputs before passing them to the flow but also confirm all required inputs available before launching the flow. This is an early detection process for misconfigured flows or missing objects.
-
Put all DML fetch actions to retrieve necessary objects at the beginning of the flow. This helps validate that the flow will be able to proceed smoothly.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Combines indexed entries in the parallel arrays of a given location object. | |
* Expects the same number of entries in each array. | |
* | |
* @param data Object with parallel values in arrays. | |
* @param separator String to use as a separator in the raw values. | |
* @param display_separator String to use as a separator in the display values. | |
* @param bottom_to_top Boolean to indicate if the values should be hierarchically displayed from bottom to top or top to bottom in the display values. | |
* @returns Object with raw and display values in parallel arrays. | |
* // The data is in the form: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Builds an array of object structure from an object with parallel values. | |
* Expects the same number of entries in each array. | |
* Similar to building a pivot table, but with a tree structure. | |
* | |
* @param data Object with parallel values in arrays. | |
* @param separator String to use as a separator in the keys from the data. | |
* @returns Array of objects with the keys from the data and the values from the data arranged hierarchically. | |
* @example | |
* // The data is in the form: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Turns a tree structure into an array of objects. | |
* @param tree Object tree with object entries attached by their IDs as keys. | |
* @returns Array of objects entries with their IDs embedded in their structure | |
* @example | |
* // given a tree: | |
* { | |
* 'a': { | |
* label: 'A', id: 'a', children: { | |
* 'a|b': { |
In most cases, I launch an Apex Replay Debugger session to review the last generated log file on my Salesforce sandboxes. However, retrieving the latest log from Salesforce to VS Code for debugging requires:
- Triggering the command to retrieve the debug logs (
SFDX: Get Apex Debug Logs...
) - Waiting and watching out for a popup that lists all the recent debug logs
- Selecting the first (or desired) debug log for download, note: the popup might easily dismiss itself if doing anything else at this stage
- Finally, launching the replay debugger for the downloaded log (
SFDX: Launch Apex Replay Debugger with Current File
)
The above steps take too much of my attention and are not fun to keep track on a spotty internet connection.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
My Awesome Sketch | |
First State | |
some event -> Second State | |
Second State |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
My Sketch | |
First State | |
some event -> Second State | |
Second State | |
some sketch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am julio73 on github. | |
* I am julio73 (https://keybase.io/julio73) on keybase. | |
* I have a public key ASBp0UYq4fSIanLBiy3wTLNiiS5uNr1mNnnKkrjz_XWGmQo | |
To claim this, I am signing this object: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
An Armstrong number is an n-digit number that is equal to the sum of the nth powers of its digits | |
""" | |
def isArmstrongNumber(x): | |
return sum([n**len(str(x)) for n in [int(d) for d in list(str(x))]]) == x | |
[x for x in range(100000) if isArmstrongNumber(x)] | |
#=> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 153, 370, 371, 407, 1634, 8208, 9474, 54748, 92727, 93084] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Output the closest n points to a random point from a pool of m 2-D coordinates. | |
# All coordinates are within the domain range 0..d | |
# m may be be smaller than n | |
def closest_2d_coords(n = 5, m = 100, d = 100) | |
rand2d_gen = ->(d) { 2.times.map { (rand*d).round }} | |
cartesian_distance = | |
->(c1, c2) { ((c1[0] - c2[0])**2 + (c1[1] - c2[1])**2)**0.5 } | |
ref_pt = rand2d_gen.call(d) |