Limit The Size of Text Entries with Text Area Plus!

Created by Nathan Shulman and Josh Dayment

updated 6/9/2022

Text Area Plus! is an improved version of the standard flow text area adding a suite of text-related tools to allow for the Flow Admin to provide a better User Experience and quicker set up than the standard flow screen components.

Text Area Plus!, currently offers two run modes Plain Text or Rich Text with some shared functionality and some unique functionality currently only available in the Rich Text run mode.

Setup Properties

Shared & Plain Text

  • Label: This is a string variable that will add a label to the text area.
  • Minimum Characters Allowed: This is the minimum number of characters required in your text area i.e. 25 will set a minimum number of characters required for the flow to advance or finish.
  • Placeholder Text: This is a string variable that is placeholder text stored in the component once the user begins typing this text is removed and replaced with what the user is inputting.
  • Initial Text Value: This is a string variable that will prepopulate the value of the component if you have a predefined value it can be stored here. This is also your output value.
  • Required: When true this requires an entry in the component
  • Character Counter: Control the visibility of the character counter when marked as true will display the character counter underneath the component.
  • Maximum Characters Allowed: This is the maximum length of your text area i.e. 25 will limit the total number of characters to 25 in the text area.
  • Characters Remaining Template: Add custom messaging to the character counter i.e. $R characters remaining until complete

Rich Text

  • Enable Advanced Tools: When marked as true will display a subset of advanced tools offered for the rich text input portion. 
  • Blocked Words: Comma-separated string variable of words the admin wants to block the user from entering into the component.
  • Blocked Symbols: Comma-separated string variable of symbols that should be blocked from being entered into the component.
  • Auto Replace Map: String variable in json format consisting of a key(word to find and replace) and value (word to replace the key with)
  • Warning Only: When true this will only warn the user of an error in the blocked words or symbols list and allow them to continue the flow if false and blocked words or symbols have a value and its found in the text it will stop the flow from advancing.

Video Walkthrough

Install

Version 1.5

Previous Versions

Version 1.0.0.0

Source Code

View Source

From Ryan Mercer: A better way to Check for Duplicate Records in Flow

You probably have Duplicate Rules configured in your Salesforce org, right? Well, if you don’t, you should check them out!

A duplicate rule defines what happens when a user views a record with duplicates or starts creating a duplicate record. Salesforce provides standard duplicate rules for business and person accounts, contacts, and leads. You can also create duplicate rules.

Duplicate rules can bring your Flow to a screeching halt if you try to create a record that already exists. Your duplicate rule is working exactly as designed; your flow, however, is not.

Screenshot of a Flow error message that reads - 'Error Occurred: This error occurred when the flow tried to create records: DUPLICATES_DETECTED: Use one of these records?. You can look up ExceptionCode values in the SOAP API Developer Guide.'

Introducing “Duplicate Record Check”

Duplicate Record Check is an Apex Invocable Action that will allow you to run your duplicate rules on records prior to creating them in your Flow. Take a look at this video introduction for an explanation as to why and how you might use this action.

How to Configure the Component

You can either pass in a single record, a collection of records, or both into the action. If using both, the single record and collection of records MUST be of the same object type!

The action will return two Apex-Defined variables of the Duplicate class:

A screenshot that shows there are two returns from the action: 1. single input return and 2. collection input return.

And each variable, will include:

  1. Whether a duplicate was found;
  2. The duplicate record’s Id; and
  3. The duplicate record’s Object name.
And each returned object has three data points: 1. Boolean identifying whether there's a duplicate, 2. the Duplicate record Id, and 3. the Duplicate record object name.

Apex Developer Support

Don’t write Apex? Feel free to skip over this!

This component is supported by the Datacloud Namespace. The shape of the Datacloud results object is a little unwieldy. You can use the DuplicateRecordCheck_Util class to make your life a little easier. Here’s how you use it:

// Assuming your Duplicate Rules are configured accordingly.
Lead ld = new Lead(
  FirstName = 'Ryan',
  LastName = 'Mercer',
  Email = 'ryangmercer@gmail.com'
  Company = 'unofficialsf'
);
insert ld;
        
sObject input = ld.clone(false,true);
List<Duplicate> duplicates = DuplicateRecordCheck_Util.findDuplicates(new List<sObject>{input});
        
system.assert(duplicates[0].isDuplicate == TRUE);
system.assert(duplicates[0].duplicateRecordId == ld.Id);
system.assert(duplicates[0].duplicatesObjectType == 'Lead');

Installation

Production or Developer Version 1.0

Sandbox Version 1.0


View Source

View Source

Use Flow to get the running User’s Time Zone offset from GMT

A couple of years ago, I created a component to convert a Date value to a Datetime value in a Flow. Recently, Andy Engin Utkan, figured out a way to use this component to overcome issues he was having when using a Display Text component in a Flow when trying to show Datetime values and have them display in the correct time zone.

You are unable to use a formula in Salesforce to determine a User’s time zone. Admins have created very complex formulas trying to calculate an offset based on the User’s State or Country but then they ran into issues trying to handle Daylight Savings Time adjustments as well.

Here’s an example presented by Eric Praud on Jen Lee’s “How I Solved This” Admin Podcast where he created a new custom object, added 9 custom fields to the User object and came up with this formula to get the hour of the day when converted to the User’s local time:

IF( OR(
ISBLANK( $User.Summertime_Start_Offset__c ),

CreatedDate< DATETIMEVALUE(DATE(YEAR(DATEVALUE(CreatedDate)),MONTH($User.Summertime_Start_Date__c),DAY($User.Summertime_Start_Date__c))
-(WEEKDAY(DATE(YEAR(DATEVALUE(CreatedDate)),MONTH($User.Summertime_Start_Date__c),DAY($User.Summertime_Start_Date__c)))-1)) + $User.Summertime_Start_Offset__c /24,

CreatedDate>=
DATETIMEVALUE(DATE(YEAR(DATEVALUE(CreatedDate)),MONTH($User.Wintertime_start_Date__c),DAY($User.Wintertime_start_Date__c))
-(WEEKDAY(DATE(YEAR(DATEVALUE(CreatedDate)),MONTH($User.Wintertime_start_Date__c),DAY($User.Wintertime_start_Date__c)))-1))+$User.Wintertime_Start_Offset__c/24

),

HOUR(TIMEVALUE(CreatedDate+$User.GMT_Offset__c /24))
+IF( AND($User.Southern_Hemisphere__c, NOT(ISBLANK( $User.Summertime_Start_Offset__c ))),1,0)
-IF(HOUR(TIMEVALUE(CreatedDate+ $User.GMT_Offset__c /24))
+IF( AND($User.Southern_Hemisphere__c, NOT(ISBLANK( $User.Summertime_Start_Offset__c ))),1,0)>23,24,0)

,
HOUR(TIMEVALUE(CreatedDate+(1+ $User.GMT_Offset__c )/24))
-IF( AND($User.Southern_Hemisphere__c, NOT(ISBLANK( $User.Summertime_Start_Offset__c ))),1,0)
-IF(HOUR(TIMEVALUE(CreatedDate+(1+ $User.GMT_Offset__c )/24))
-IF( AND($User.Southern_Hemisphere__c, NOT(ISBLANK( $User.Summertime_Start_Offset__c ))),1,0)>23,24,0)

)

Andy figured out that taking the difference between the Datetime returned by my component (midnight GMT) and the Datetime returned by the Flow formula DATETIMEVALUE(Date) you would get the GMT Offset for that date based on the running User’s time zone.

Here’s a sample sub-flow I created that you could use to get the User’s GMT Offset for any date. You can call this sub-flow anywhere you need to get the offset to use in Datetime value calculations for the User’s time zone.

A Date Variable is created for Input and a Number Variable is created for Output.

A Formula is used to assign a default value of Today if no date value is passed into the flow.

The result of the fDate formula is passed into the Convert Date to Datetime Flow Action

And finally, the difference between the two Datetime values is calculated, converted to hours and passed back to the calling Flow.

Here’s an example of how you could call this sub-flow from your flow.


Depending on the date, the difference between GMT (Greenwich Mean Time) also known as UTC (Coordinated Universal Time) and the User’s time could be different.

For Example:

From the second Sunday of March at 07:00 UTC until the last Sunday of March at 01:00 UTC, London is four hours ahead of New York.

From the last Sunday of March at 01:00 UTC until the last Sunday of October at 01:00 UTC, London is five hours ahead of New York.

From the last Sunday of October at 01:00 UTC until the first Sunday of November at 06:00 UTC, London is four hours ahead of New York.

From the first Sunday of November at 06:00 UTC until the second Sunday of March at 07:00 UTC, London is five hours ahead of New York.

So, for me in the Eastern Time Zone, running the Flow with a Date of 3/1/2022 returns a value of -5 for my offset from GMT.

However, because of Daylight Savings Time, running the Flow with a date of 3/15/2022 returns the correct GMT offset of -4 for that date.


Get the Convert Date to Datetime Flow Action on UnofficialSF.
https://unofficialsf.com/convert-date-to-datetime-flow-action/

Find more from Eric Smith on his blog.
https://ericsplayground.wordpress.com/

Find out more from Andy Engin Utkan on his blog.
https://salesforcebreak.com/

Orchestrator Pricing

Orchestrator is generally available and here’s an unofficial FAQ on how it will be priced.

How is it sold?

The product will be sold via a Service Cloud add-on license.

What’s the Freemium Allocation?

All PxE, Enterprise, Enterprise, and Unlimited Editions get 600 annual runs included (regardless of org size).

Pricing Before any Discounts?

It’s a consumption-based SKU which means you pay $1 per orchestration run, and it’s sold in yearly increments. Customers purchasing in volume can seek discounts, as is usual.

Is there a way to extend Orchestrator usage to non-Salesforce users in my org?

Yes. There’s a new ‘no-cost’ Limited User License in the works that is designed to be assigned to users who don’t already have a user license. This will allow them to log into Salesforce and participate in orchestrations. The license will have limitations on it, so it isn’t a substitute for a typical Salesforce license. Final details are still being worked out.

Learn more about Orchestrator.

From Narender Singh: A Dependent Picklist That Support Default Record Types

The Out-of-the-Box Dependent Picklist isn’t record-type aware, but Narender has created an installable version that goes farther.

Check it out!

Add a little automation to publishing your packages from VSCode

If you are tired of keeping track of all the right commands you need to use to create and publish your own packaged components from VSCode, here are a couple of recent blog posts from Narender Singh and Eric Smith on how they’ve taken some of the complexity out of the process.

From Akihiro Iwaya: Adding Approval Functionality to Orchestrator

Akihiro-san has done some of the most in-depth early consumption of Orchestrator. Here he demonstrates a number of techniques for lighting up approval processes.

Orchestrator goes GA in Spring ‘22 with new enhancements!!

  • Assignment to Queues and Groups
  • Reassignment of Work Items
  • Cancel a running orchestration
  • API access to trigger Orchestrations

I have been exploring the use of Orchestrator for approvals use cases. Previously I concluded that  “I have confidence in replacing the approval process with Flow Orchestrator because I believe that new functionalities related to the approval process will be available at GA. My implementation of the approval process is a little bit complicated because of lacking standard functions such as supporting Autolaunched Flow, recall approval process (back to previous stage), standard actions (lock & unlock record, get queue member) but I am very excited to continue to watch new features.

In this post I’ll look more deepily at approvals use cases using the GA Orchestrator feature set. I will show three approval process examples using a simplified Employee Time Off Application with minimum automated actions. 

Examples

Automatically assign an approver using the manager field in User.

The second example is using the new enhancement of “Assignment to Queues and Groups”. Submitter and the first approver can choose either a user or a queue. 

  • Example 3: User Can Dynamically Choose Next Approvers: 

The final example makes use of the new enhancement of “API access to trigger Orchestrations”.  Submitters can select one of the orchestrators to initiate new orchestration on Screen flow calling Apex action. This is a great enhancement because the user dynamically chooses any orchestrator on the fly. At this Example, the submitter selects a route table record containing three approvers and serial or parallel orchestrator during submit for approval. Again you can add functionalities that are implemented at case1 and case2.

Example 1: Simple Approval Process1 using the Manager Field

The first example is very simple and familiar with the legacy approval process. Automatically assign an approver using a manager field in the user table. There are only two approval steps but you can add more steps.

Features

  • Assign an approver using a manager field
  • Return approval request to previous approver after final approval
  • Track and view approval history
  • Custom ‘Lock Record Behavior
  • Custom notification
  • Eemail notification

Video

Creating Custom ‘Lock Record’ Behavior using Record Type

When the user clicks on this custom Submit for Approval button, the record type of the underlying record is changed. There are two record types, new and read-only with corresponding page layout

. This allows for these behaviors:

  • The Submit for Approval button vanishes. This is enabled in part by the recently introduced Dynamic Actions, a feature that allows admins to choose which actions need to appear in the Highlights Panel on the object’s record page
    • The new record type is linked to a read-only page layout, creating the effect of a Lock Record process.
  • Additional Notes:
    • There is one concern that required fields can not be Read-Only in the layout. Since those fields are always editable, I decided that no fields are required at this object.
    • Replace “New” button : There are two reasons for replacement of New button. Users can not skip record type selection page for default new button and after hitting new button, screenflow shows record creation form with validation of required fields. 

Custom Notification

The Messaging Notification(?) action is used to generate custom notifications:

Work Guide Usage

Approval is done in the Work Guide, where conditional field visibility shows only the necessary fields:

Approval History

Approval History items are logged to enable the full history to be easily views:

Recording

Orchestration

Example 2 Approval Process Using Queues/Groups

The second example highlights the abillity of Spring ‘22 Orchestrator to “Assignm to Queues and Groups”. This example doesn’t provide a way to  return the approval request to other approvers but you can easily add that as was shown in  Example1.

Features

  • choose a user or a queue 
  • approval history
  • lock / unlock record
  • custom notification
  • email notification

Choosing a Queue with a Custom ‘Submit for Approval’ Flow

Recording

Orchestration

Example 3 :User Can Dynamically Choose The Next Approvers

The final example demonstrates the power of the new feature  “API access to trigger Orchestrations”.  Submitters can select one of the orchestrators to initiate new orchestration on Screen flow calling Apex action. This is a great enhancement because the user dynamically chooses any orchestrator on the fly. 

To enable this, I created a custom object called  a route table where I can configure different combinations of approvers:  

Features

  • route table (custom object) containing three approvers
  • choose either parallel or serial orchestrator
  • return the approval process to other approvers at serial mode
  • approval history
  • lock / unlock record
    • Change record owner to System User so that submitter and approvers can not edit
  • custom notification
  • email notification

When the record is submitted, this version of the orchestration let’s them choose between Serial and Parallel, and lets them choose one of the predefined routes:

Serial mode

Parallel mode

Recording

Orchestration

Serial mode

Parallel mode

Legacy Approval Process Features

There are legacy approval process features and corresponding implementation ideas on Orchestration. 

Create an Approval Process with the Standard Wizard

There are three ways to implement “No one can edit a record after submit for approval except admin” functionalities in my examples. The legacy approval process allows administrators to edit or the both administrators and the assigned approver to do. In case you need that the assigned approver also edit a record, “Changing record owner” may be one you take. Before assigning a work item to an approver, the record owner is updated to the approver in flow.

  • Example1 : Dynamic action,record types, replace new button
  • Example2 : Apex Approval Class
  • Example3 : Change record owner
  • Design the Approval Request Page
    • You can design whatever you like on Screen flow  for the approval request
  • Specify Who Can Submit Records to an Approval Process
    • Record-Trigger Orchestration can not set an entry condition with a hierarchy field. So you need to go a long way around to achieve it. 
      • flow action
        • Dynamic action can control who can submit records to an approval process
      • screen flow
        • Update records element update field value
        • Updating field value kicks your Record-Trigger Orchestration
  • Dynamic action can control action buttons on your record pages. You can set action visibility in order to hide/show your action button that executes your Autolaunched Orchestration 

Add an Approval Step to an Approval Process

Automated Actions to an Approval Process

Prepare Your Org for Approvals

Approval History Reports

Manage Multiple Approval Requests

Approval Requests for Users

Conclusion

Orchestrator CAN be a replacement of the legacy Approval Process and implemented with a more complicated scenario. But in case the legacy approval process supports your requirement, then implement it by legacy one. Otherwise you develop your own approval process on Orchestrator. Before Approval Process Flow Templates will be officially distributed, we utilize a hybrid of the legacy and orchestrator for the approval process.