RSS

Category Archives: Visual Flow

Regex in Salesforce

Regex in Salesforce

(Pardon the dust. ūüôā This post is still a work in progress!)

Regex is a confusing language to me. But even though I find it confusing, I recognize it’s power to verify input. Here are my (ongoing) notes on Regex.


What is Regex?

Regex is a sequence of characters that defines a string pattern. Huh? Let’s break that down:

  • Regex is short for “regular expression”
  • A “regular expression” is a sequence of characters
  • That sequence of characters may look more like hieroglyphics than anything else
    • regex
  • Those hieroglyphics define a string pattern
  • A string pattern is a string of characters, such as a username or an email address

So Regex is hieroglyphics that define a string. ūüėÄ


Regex Names, Engines, and Flavors

Other Namesflavors

Regex is also known as Regexp.

Engines & Flavors

Regex is processed by software called an Engine. And to complicate things, there are lots of different engines, each with its own unique way of interpreting the regular expression. The syntax and behavior of a particular engine is called a regular expression flavor. What this means is that if you’re using Regex in Java you’ll be using one flavor, and if you’re using Regex in Python you’ll be using another flavor.

What Flavor Does Salesforce Use?

Salesforce uses the Java flavor (see Java.Util.Regex Class Pattern).


Where Is Regex Used In Salesforce

Salesforce has a REGEX function that is available in field validation formulas, Visual Flow, and Apex. The REGEX function is not available in formula fields or in Visualforce. Boo.


The Salesforce Regex Function

The Salesforce Regex Function looks like this:

REGEX(the_string_to_check, the_regular_expression)


Using REGEX In Validation Rules

Validation rules look for errors. If an error is found (the validation rules evaluates to True), an error message is displayed and the user must correct their input before the record can be saved.

This means that when you’re writing REGEX that matches what you want in the field you’ll need to negate the final result like this:

NOT(¬†REGEX(Zip__c, “[0-9]{5}(-[0-9]{4})?”)¬†)


Getting To The Nitty-Gritty Of Understanding Regex

nitty grittyOkay, so how do you start to understand Regex gobbly-gook? You take it just one little bite at a time!

So here we go!

gobbledygookHow characters are represented in Regex

Other than special characters, what you see is what the Regex formula is looking for. In this example the formula is looking for the letter “u” and only the letter “u”. If anything else is present the formula will evaluate to false:

REGEX(String, “u”)

A set of characters, or Character Class, is a group of characters between brackets. Character classes allow for several different characters to be present at a given location in the string. In this example the formula is looking for a single character, the letter “a”, the letter “f”, or the digit “2”:

REGEX(String, “[af2]”)

To include all the characters between two given characters you can use a dash. In this example the formula is looking for a single character between “t” and “x” or between “R” and “Y”:

REGEX(String, “[t-xR-Y]”)

Negation

To exclude characters you put a carat (^) at the beginning of the character class. In this example the formula is looking for a single character other than “g”, “e”, or “n”:

REGEX(String, “[^gen]”)

Note: the carat is a special character that has dual meaning. When it is used within a character class it means negation. When it it used outside of a character class it signifies the beginning of the string (see further down in the post for this).


Grouping

grouping

Characters can be grouped together by including them between parentheses. In this example the string “bouncy ” is grouped and the entire function matches the string “red bouncy ball”:

REGEX(String, “red (bouncy )ball”)

 


Wildcard Characters and Repeating Pattern Quantifiers

Wildcard-80lv

When you need to match any character or a given token zero or more times you can use wildcard characters and repeating patterns:

  • . (period) – Match any character except a line terminator
  • ? (question mark) – Match the preceding token 0 or 1 times
  • * (asterisk) – Match the preceding token 0 or more times
  • + (plus sign) – Match the preceding token 1 or more times
  • {n} – Match¬†the preceding token n times
  • {n,} – Match the preceding token n or more times
    • Note: {0,} is equivalent to * and {1,} is equivalent to +
  • {n,m} – Match the preceding token at least n times and no more than m times
    • Note: {0,1} is equivalent to ?

Examples:

  • REGEX(String, “pe.k”) will match “peak”, “peek”, “pe2k”, etc.
  • REGEX(String, “goat(ee)?”) will match “goat” and “goatee”
  • REGEX(String, “red (bouncy )?ball”) will match “red ball” and “red bouncy ball”
  • REGEX(String, “tiger9*”) will match “tiger”, “tiger9”, “tiger99”, “tiger999”, etc.
  • REGEX(String, “(lily)+”) will match “lily”, “lilylily”, “lilylilylily”, etc.
  • REGEX(String, “(boo){2}”) will match “booboo”
  • REGEX(String, “7{2}”) will match “77”, “777”, “7777”, etc.
  • REGEX(String, “xo{3,4}”) will match “xoxoxo” and “xoxoxoxo”

“Greedy,” “Lazy,” and “Possessive” Quantifiers

When an engine parses a string with quantifiers (things that multiply characters) there are ways to help the engine be more efficient. This is where “greedy,” “lazy,” and “possessive” quantifiers come. While it’s mostly not necessary to know the difference, it is helpful when reading someone else’s Regex to know what these things mean.¬† See this site for an excellent explanation of quantifiers.

Greedy Quantifiers

The special characters ?, *, +, {n}, {n,}, and {n,m} are called “greedy quantifiers” because they match as many characters as possible.


Lazy Quantifiers

Quantifiers combined with the question mark create what are called “Lazy Quantifiers.”

  • ?? – once or not at all
  • *? – zero or more times
  • +? – one or more times
  • {n}? – exactly n times
  • {n,}? – at least n times
  • {n,m}? – at least n times and up to m times

At first blush at appears that there isn’t any difference. The difference lies in how the engine parses the string to look for a match. With greedy quantifiers the engine will try to match as many instances of the quantified token as possible. With lazy quantifiers the engine will try to match as few as needed.


Possessive Quantifiers

Quantifiers combined with the plus sign create what are called “Possessive Quantifiers.”

  • ?+ = once or not at all
  • *+ – zero or more times
  • ++ – one or more times
  • {n}+ – exactly n times
  • {n,}+ – at least n times
  • {n,m}+ – at least n times and up to m times

These quantifiers are helpful when you want a match must fail quickly if it doesn’t follow a particular pattern. Using possessive quantifiers can increase the efficiency of your Regex function.


Special Characters and Metacharacters

SesameCharacters

Special characters are characters that have a special meaning to the regex engine. Metacharacters are special characters used within a character class.

Special Characters

These are the special characters in Regex:

  • \ (backslash) – is combined with another character to mean something else
  • ^ (carat) – 1) denotes the beginning of a line or 2) negates a character class
  • $ (dollar sign) – denotes the end of a line
  • . (dot or period) – represents any single character except a line terminator
  • | (pipe or vertical bar) – is used as an “OR” operator
  • ? (question mark) – multiplies a token 0 or 1 time
  • * (asterisk) – multiplies a token 0 or more times
  • + (plus sign) – multiplies a token 1 or more times
  • – (dash or hyphen) – used for indicating a sequence (range) of characters
  • () (parentheses) – enclose character groups
  • [ (open bracket) – enclose character classes
  • { (open curly brace) – used when multiplying a token a specified number of times

Metacharacters

Any of the special characters except these, the metacharacters, can be used within a character class (a group of characters within brackets) without escaping them. Metacharacters have special meaning within a character class depending on where they are used. If used in their special places, they have special meaning and you would need to escape them in order to test for the actual character. If used in their not-so-special places, they do not need to be escaped.

These are the metacharacters in Regex:

  • ] (closing bracket)
    • it’s special place is anywhere after the first position in the character class or after the negating carat
    • Example: “[]xyz]” tests for a closing bracket and the letters “x”, “y”, and “z”
      • This can also be written “[xyz\]]”
    • Example: “[^]867]” tests for anything that is not a closing bracket or the digits “8”, “6”, or “7”
    • Example: “[tip\]] tests for a closing bracket and the letters “t”, “i”, and “p”
      • This can also be written “[[tip]”
  • \ (backslash)
    • the backslash must always be escaped within the character class if it’s a character you’re testing for
    • Example: “[+-$*\\]” tests for +, -, $, *, and \
  • ^ (carat)
    • it’s special place is right after the opening bracket. Placed anywhere else it is just a character
    • Example: “[^pex]” – Here the carat means “not”. This would test for anything except the characters “p”, “e”, and “x”
    • Example: “[This^Too]” – Here the carat is nothing more than a character
  • – (dash or hyphen)
    • The hyphen has three special places:
      • right after the opening bracket
      • right before the closing bracket
      • right after the negating carat
    • used anywhere else it is just a character

Escape Character

The escape character is the backslash (\) character. This means to represent any special character in a string you would need to put the backslash in front of it like this:

  • \\\\ – the backslash character
  • \^ – the carat character
  • \$ – the dollar sign character
  • \. – the period character

Backslash – Character Combinations

Certain characters combined with a backslash represent certain non-alphanumeric characters:

  • \\t – tab character
  • \\n – new line (linefeed) character (this is a line terminator character)
  • \\r – carriage return character (this is a line terminator character)
  • \\f – form feed character
  • \\a – alert (bell) character
  • \\e – escape character
  • \\cx – the control character corresponding to “x” (ctrl-B would be “\\cB”)

Predefined Character Classes

The following are predefined character classes you can use:

  • . (period) – matches any character except a line terminator
  • \\d – matches any digit (shorthand for “[0-9]”)
  • \\D – matches any non-digit (shorthand for “[^0-9]”)
  • \\s – a white space character (space, tab, new line, form feed, carriage return, and \\x0B)
  • \\w – a “word character” (shorthand for “[a-zA-z_0-9]”)
  • \\W a non-word character (shorthand for “[^a-zA-z_0-9]” or “[^\w]”)

Boundaries

fence

Boundaries are things like the beginning or end of a line or a word. These are the boundary characters you can use:

  • ^ – the beginning of a line
  • $ – the end of a line
  • \\b – a word boundary
  • \\B – a non-word boundary
  • \\A – the beginning of input
  • \\G – the end of the previous match
  • \\Z – the end of the input except for a final terminator
  • \\z – the end of the input

Some Sample Regex Formulas

  • California Drivers License
    • REGEX(Drivers_License__c, “([A-Z]\\d{7})?”)
    • Example matches:
      • C7768934
      • nothing (the ? means 0 or 1 item)
    • Checks for a capital letter followed by 7 digits
  • Credit card number
    • REGEX(Credit_Card__c, “(((\\d{4}-){3}\\d{4})|\\d{16})?”)
    • Example matches:
      • 1234-1234-1234-1234
      • 1234123412341234
      • nothing (a blank field)
  • Email address
    • email regex
  • Number between 100 and 99999
    • \\b[1-9][0-9]{2,4}\\b
  • US Phone Number
    • REGEX(Phone,¬†“((\\([2-9]\\d{2}\\) ?[2-9]\\d{2}-\\d{4})|(([2-9][0-9]{2}-){2}\\d{4})|(([2-9][0-9]{2}\.){2}\\d{4})|([2-9]\\d{2}){2}\\d{4})?”)
    • Example matches:
      • (223)456-7890
      • (223) 456-7890
      • 223-456-7890
      • 223.456.7890
      • 2234567890
      • nothing
    • Interesting note: the area code and “exchange” code (the first three digits after the are code) cannot start with 0 or 1 (these numbers are reserved for special purposes). All the other digits can be any number¬†from 0 to 9.
  • Social Security Number
    • REGEX(SSN__c, “((\\d{3}-\\d{2}-\\d{4})|\\d{9})?”)
    • Example matches:
      • 123-45-6789
      • 123456789
      • nothing
  • US Zip Code
    • REGEX(BillingPostalCode, “\\d{5}(-\\d{4})?”)
    • Example matches:
      • 95610
      • 84328-4484

Some Regex Resources

regex

  • Regular-Expressions.info¬†– This site is a good place to learn more about Regex. Their tutorial jumps around a little bit, but for the most part is laid out fairly linearly.
  • Java.Util.Regex Class Pattern¬†– This is the Regex pattern that Salesforce uses with the one exception that the backslash character must be escaped with a backslash since it’s a special character in Salesforce. This means that instead of writing \d to indicate a digit from 0 to 9 you would need to write \\d (the first backslash tells Salesforce to use the second one for just what it is, a backslash character and not a special character).
  • Regex101.com¬†– This site is great for testing your Regex. You enter the expression in the top space and in the Test String space you place some strings. The window to the right of these spaces will tell you how the expression worked.
  • Regexr.com¬†– This is another site for testing your Regex.
  • RegexLib.com¬†– Browse for useful expressions and test your own expressions.
  • Regex Quantifiers¬†– This site is an excellent tutorial on quantifiers and much, much more
 
1 Comment

Posted by on June 8, 2017 in Formulas, Visual Flow

 

Tags: ,

Visual Flow to Return Letters Only

Visual Flow to Return Letters Only

Have you ever wanted to extract just the letters out of a string? Here is a super quick Flow that you can use to do that. And with just a little tweaking you can adapt it to return additional characters to your liking!


Return Letters Only Flow

Letters Only Flow


Variables

Variables

  • count is initialized to zero

Formulas

Formulas

  • CurrChar = MID({!InputString}, count, 1)
  • IsLetter =¬†REGEX({!CurrChar}, “[a-zA-Z]”)
  • LenInputStr =¬†LEN({!InputString})

Flow Logic

  1. Check the character count against the length of the input string. If it is less than the length, proceed to next element
  2. Increment the character count variable
  3. Check the character in the input string in the count position with a REGEX formula to see if it’s a letter
    1. IsLetter
  4. If it’s a letter, add it to the output string

That’s it! Super simple, but could be really handy.


Other Possibilities

Regex is super cool. I know almost nothing about it, but am learning, and am putting together a little write-up to explain its basics, so stay tuned. In the meantime, here are some other possibilities:

  • Check for digits and letters:
    • REGEX(String, “[a-zA-Z0-9]”)
  • Check digits only:
    • REGEX(String, “[0-9]”)
    • This can also be written: REGEX(String, “\\d”)
  • Check for letters, period, space, hashtag, dash, comma, slash:
    • REGEX(String, “[a-zA-Z. #\\-,/]”)

Cheers!

 
1 Comment

Posted by on June 7, 2017 in Flow Tips & Tricks, Visual Flow

 

Tags: ,

Line Feeds in Visual Flow

Line Feeds in Visual Flow

Line feeds, or carriage returns, often seem to be a tricky thing to get into a text field. Here are a couple ways to get them in:


Line Feeds In Text Fields That Support HTML

Using <br/> Text Template

To add line feeds between strings¬†that will be saved to a text field that supports HTML you can¬†add the characters “<br/>” wherever you want there to be a line feed.

This works for text fields that support HTML only. Long Text fields, such as Description fields, do not support HTML, so this trick will not work. Instead you will see <br/> between strings in the field.

To get those characters into the text do the following:

  • Create a Text Template that has a value of “<br/>”Line Break Chars
  • Add the template between strings
  • Add Line Break Between Strings

Using ~ ~ Text Template

Here is another way to create a line break in a text field, and this method will work for Long Text fields, such as Description fields:

  • Create a Text Template where you enter a character, like a period or the squiggly characters, hit Enter to go to the next line, and enter the character again:
  • Line Break Chars
  • Use the template in a formula to combine strings:
  • Combine strings with break

You can also get creative with this one and insert a separator between strings:

  • Line Break Chars

Using ~ ~ Custom Label

The same trick as above can be done with a Custom Label (Setup > Create > Custom Labels). This has the added advantage that you only need to setup a Custom Label once and you can then access it in all your flows.

  • Create a Custom Label in the same way you would create a Text Template:
  • Line Break Chars
  • Now in your flow access the Custom Label using the $Label global variable:
  • Line Break Chars.JPG

Cheers!

 
Leave a comment

Posted by on May 31, 2017 in Flow Tips & Tricks, Visual Flow

 

Tags:

Global Variables in Visual Flow

Global Variables in Visual Flow

In the Spring ’16 release, Salesforce opened up access to several fields on some of the system objects with the use of Global Variables.

Global Variables are special variables that give you direct access to system objects that are in context. For instance, the $User Global Variable gives you access to the User who is currently running your Flow. (Here is a little about Global Variables in a prior post.)

Global Variables have a special nomenclature–they are always preceded with a dollar ($) sign:

  • $Api
  • $Label
  • $Organization
  • $Permission
  • $Profile
  • $Setup
  • $System
  • $User
  • $UserRole

Essentially a Global Variable is “merged” with a “merge field” to give you access to the value that is stored in that field. The exception is with the $Permission Global Variable, where the result you get is True, the permission is present for the current User, or False, the permission is absent.


How to Use Global Variables in Visual Flow

A few Global Variables are generally available everywhere in Visual Flow, but a few are available in one place only: Formulas

So if you don’t see the one you need, no worries, just create a formula which you can then use in the rest of your flow like you would a constant or variable:

formula for global variable


A Few Examples of Ways to Use Global Variables

  • Greet the user by their name:
    • $User.FirstName
  • Determine if the user has a Custom Permission:
    • $Permission.custom_permission_name
    • With this Global Variable the return result will be either true (the Custom Permission exists for the user) or false (they do not have the permission)
  • Determine what Profile the user is assigned to:
    • $Profile.Name
  • Get the value of a Custom Label:
    • $Label.the_name_of_a_label_you_have_created
    • (You can use a Custom Label to create a line feed in a text element.)
  • The Name, State, Phone, Address, etc. of the org:
    • $Organization.Name

Bottom line is using Global Variables gives you instant access to a bunch of information without having to do a query, which is always a good thing.

Cheers!

 
Leave a comment

Posted by on May 31, 2017 in Flow Tips & Tricks, Visual Flow

 

Tags:

Displaying Tables in Visual Flow

Displaying Tables in Visual Flow

I’m a big sucker for adding things to my Flows that will make them look cooler. Just today I came across an article about using HTML to display information to the user in a table format. Hold the phone! That’s cool!

So I dug into it and here is what I have discovered.


HTML Table Basics

An HTML Table is defined by just a few tags:

  • <table> </table> (specifies the beginning and end of a table)
  • <tr> </tr> (specifies the beginning and end of a table row)
  • <th> </th> (specifies the beginning and end of a table header)
    • table headers are bold by default
  • <td> </td> (specifies the beginning and end of an table entry or table data)
Table Examples

Two Basic Table Examples

.

The basic structure of the horizontal table is as follows:

<table>

<tr> <th>Column 1</th> <th>Column 2</th> </tr>

<tr> <td>Row 1 First Item</td> <td>Row 1 Second Item</td> </tr>

<tr> <td>Row 2 First Item</td> <td>Row 2 Second Item</td> </tr>

</table>

And the basic structure of the vertical table is like this:

<table>

<tr> <th>Row 1</th> <td>Name</td> </tr>

<tr> <th>Row 2</th> <td>Tristan</td> </tr>

<tr> <th>Row 3</th> <td>The Great</td> </tr>

</table>


Adding Attributes to the Tags

Once the basic table is setup it’s time to start adding attributes that will give it the desired look.

Basic <table> Tag Attributes

borders

The first attribute to consider is¬†the ones that defines the table borders. In the examples given the first table has a¬†borders=”5″ attribute, and the second a borders=”1″.

<table borders=”5″> ¬†<table borders=”1″>

The borders attribute will take any whole number where that number is the thickness of the border in pixels.

width

The width of the table can be expressed in pixels, or as a percentage of the available space:

<table width=”300″> ¬†or ¬†<table width=”70%”>

If the width attribute is omitted the table will occupy the width of its container element.

cellpadding

Cell padding is the space between cell borders and cell content, expressed in pixels.

<table cellpadding=”10″>


Adding a Caption Tag

To add a title to the table, the caption tag can be inserted immediately after the opening table tag:

<table> <caption>This is a Vertical Table</caption> …


Adjusting Font Color, Size and Face

Use the font tag to adjust the color and size of font anywhere in the table:

<font color=”blue” font size=”2″ font face=”arial”>

The font size can be a whole number between 1 and 7.


Adjusting Positioning of Text

For the table data tags, the position of text can be adjusted with the align attribute:

<td align=”center”> ¬†<td align=”right”>


Attributes That Don’t Seem to Work

There appears to be several attributes that do not work as expected. For example, I couldn’t get the following attributes to affect the look of the table the way I wanted:

  • bgcolor, in any of the tags, does not seem to work
  • align, when used in the <th> tag, does not align the table header
    • a workaround may be to use <td> tags combined with the <font> tag to get the look you want
  • rowspan & colspan made the table look funny

I didn’t explore all available attributes, so just be aware that even if you want to do something fancy, the Cloud Flow Designer may not want to play along.


Additional Notes

Although I could not find a reference which states what version of HTML is used in the Cloud Flow Designer, it’s my guess that its version 4.01.

Cheers!

 

 

 
Leave a comment

Posted by on January 12, 2016 in Flow Tips & Tricks, Visual Flow

 

Tags: , ,

Subflow to Convert Text to Proper Case

Subflow to Convert Text to Proper Case

Different users have different typing styles, and if you’re like me, you like your database to be nice and tidy, with everything typed out as similarly as possible. In other words, you don’t want shouting (ALL CAPS), or whispering (all lower case) in certain fields, like names and addresses.

In Excel there is a handy function called PROPER that handles this. Unfortunately Salesforce doesn’t have an equivalent function.

Here is a little subflow you can use for converting the case of a text field to proper case.

June, 2017 Update: I recently augmented the flow with the following features:

  • Return a 1- or 2-character input string in all upper case
  • Allow for exceptions for little words that are not usually capitalized in a title (The Chicken Crossed the Road), or parts of a person’s name that are not traditionally capitalized (Chicken Little von Housen)
    • To do this the Flow looks for spaces. Each word is saved in lower case to a variable. At the end of the word (when a space is encountered) it is checked against a list of exceptions and if it is in the list the end of the output string is replaced with the lower case word.
  • Capitalize the first character after certain characters, like an apostrophe or dash
    • Example: O’Brien, Jules-Jules

The ProperCase Flow

ProperCaseFlow

 


Constants and Variables

 

  • AutoCapChars are the characters that indicate the next letter should be capitalized, like an apostrophe or dash
    • Examples: O’Leary, Walla-Walla
  • counter is incremented each time through the loop and compared with StringLen to see if the entire string has been examined. Counter¬†is given a default value of 1, and StringLen is given a default value of 0.
  • CurrentWord is the string of characters between spaces. Every time a space is encountered the current word is inspected to see if it is an exception.
  • InputString is an Input variable that receives the string to be converted to proper case. It is given a default value of EmptyString.
  • OutputString is the final result. It is given a default value of EmptyString.
  • IsFirstChar is used to indicate if the character being examined is the first character of a word. It is given a default value of True.
  • IsPersonName¬†is an optional input variable for the calling flow to set to true (its default value is false). This is used to determine what list of exceptions to compare each word to.
  • MidString holds each character of the string one-by-one as the string is parsed

Text Templates

Exception Lists

Text templates are used to store a list of words that are typically left in lower case, such as “von” in a person’s name or wee-small words in a title (“the”, “an”, etc.). These templates are used in a CONTAINS function and when that function receives a string that has the colon character (:) it perceives the colon as a separator between sub strings. That means that “von:van:de” is seen as three separate words by the CONTAINS function.

Constants or Variables could be used in lieu of Text Templates.

Exception Lists


Formulas

Formulas

  • GetCurrWordFirstChar: IF(count=1, UPPER(MidString), MidString)
  • GetNextChar: MID(InputString, counter, 1)
  • GetStringLen: LEN(InputString)
  • LenTrimMidStr: LEN(SUBSTITUTE(MidStr, ” “, “”))
  • PrepString:¬†LOWER(TRIM(InputString))
  • ReplaceOutputStrLastWord: LEFT(OutputString, LEN(OutputString) – LEN(CurrentWord)) + CurrentWord
  • SetToUpper: UPPER(MidStr)
  • WordInExceptionList: IF(IsPersonName, CONTAINS(NameExceptions, CurrentWord), CONTAINS(TitleExceptions, CurrentWord))

Flow Logic

Check Length of Input String

The first steps are to trim excess spaces out of the input string and set it all to lower case. After that, check the resulting length. If it is zero, then exit the flow.

I’ve also decided that if the trimmed input string is 1 or 2 characters long that I’ll capitalize the entire input string, then exit the flow. This is done so that situations where a first name is an abbreviation, like “TJ”, are accommodated.

Parse Input String

The rest of the flow parses the input string one character at a time. The first assignment puts the character at the position of the count variable into the MidStr variable.

Get Next Char

A three-way decision is then made.

  • If it is the first character it is saved in lower case in the CurrentWord variable and it in upper case to the MidStr variable.
    • First Character Assignment
  • If the character is contained within the AutoCapChars string (like an apostrophe or dash) then the AutoCap variable is set to True
    • AutoCapAssignment
  • If it’s not the first character and not a space, then one of two things can happen:
    • 1. It’s not an auto-cap character so it is saved in lower case to both the CurrentWord and MidStr variables
      • Not First Character
    • 2. It is an auto-cap character and is saved to both the CurrentWord and MidStr variables in upper case (and AutoCap is set to False)
  • If it is a space then IsFirstChar is set to true and CurrentWord is compared with a list of ¬†words that should remain in lower case.Word in exception List
    • If CurrentWord is in the exception list, then the end of OutputString is replaced with CurrentWord.Replace End of Output String

Finally, the MidStr is appended to OutputStr,¬†the counter is incremented, and we’re taken back to the start of the loop.


AutoCap

‘Hope this helps someone.

Cheers!

 

 

 
Leave a comment

Posted by on December 10, 2015 in Visual Flow

 

Tags: ,

DML Operations in Visual Flow

DML Operations in Visual Flow

This post is a work in progress about how the database operations (DML operations) work in Visual Flow, and how to use them optimally.

Database Functions:

  • Fast Create
  • Fast Delete
  • Fast Lookup
  • Fast Delete
  • Record Create
  • Record Delete
  • Record Lookup
  • Record Update

Deleting Records

What Happens if No Records Match the Filter Criteria?

Delete operations will throw a Fault if no records are found that match the filter criteria.

Record Delete Error

No Records Found Delete Error

.

Therefore, if you don’t know for sure if records exist that will match the filter criteria, you¬†cannot do a Record Delete by itself.

Record Delete

Record Delete

.

Instead you must do a Lookup then check to see if records exist before you perform the delete.

Deleting Sequence

Deleting Sequence

 


Asides:

 
Leave a comment

Posted by on December 2, 2015 in Flow Tips & Tricks, Visual Flow

 

Tags: ,