Visual Flow – Cross Object Formulas

 

Salesforce Notes:

Tips for Cross-Object Field References in Flows

Cross-object field values are valid wherever you can reference a flow resource or manually enter a value. Keep these implementation tips in mind when you use a cross-object field reference.
Available in: both Salesforce Classic and Lightning Experience
Available in: EnterprisePerformanceUnlimited, and Developer Editions
When you create an sObject variable to reference fields on related records from, store the ID for the first related record in the variable. For example, to reference an opportunity’s contract, store ContractId in the sObject variable or add a value for ContractId by using an Assignment element.

Unsupported Relationships

The following relationships aren’t supported in cross-object field references.

  • Lead.ConvertedAccount
  • Lead.ConvertedContact
  • Lead.ConvertedOpportunity

Avoiding Null Values

If a flow interview encounters a null value at any point in the cross-object expression, the element containing the reference fails. The reference runs successfully if the last field value in the expression is null. For example, store a contact in {!sObjContact} and try to reference {!sObjContact}.Account.Name. The flow fails if AccountId on the stored contact is null (because there isn’t an account to look at), but it succeeds if Name on the related account is null.

If an element contains a cross-object reference that fails and the element doesn’t have a fault path defined, the entire interview fails. To avoid this situation, you can:

  • Make the fields that you want to reference in the expression required in Salesforce. For example, for the expression {!sObjContact}.Account.Name, you could require AccountId on contact page layouts. Then, using another flow, find any records with null values for that field and update them.
  • Determine whether each field that’s referenced in the expression has a value by using the wasSet operator in a Decision element.

Cross-Object Field References and Org Limits

Cross-object field references in flows don’t count against your org’s limits for:

  • Cross-object relationships per object
  • DML operations per transaction

Cross-Object Field References in Flows: Simple Relationships

Most relationships are straightforward. For example, Case.AccountId links directly to the case’s parent account. If you know that a field relationship ties your object to exactly one other object, use this syntax.
Available in: both Salesforce Classic and Lightning Experience
Available in: EnterprisePerformanceUnlimited, and Developer Editions

To reference a field on a related record, use this syntax.

1 {!sObjectVariable.objectName1.objectName2.fieldName}
where:

  • sObjectVariable is the unique name for the sObject variable that you want to start from.
  • objectName1 is the API name for an object that’s related to sObjectVariable’s object type. The API names for all custom objects end in __r.
  • (Optional) objectName2 is the API name for an object that’s related to objectName1.

    Your expression must include at least one object name, but you can add more objects as needed.

  • fieldName is the name for the field that you want to reference on the last object in the expression. The API names for all custom fields end in __c.

For example, {!sOv_Contact.Account.Id} references Id of the account that’s related to the contact record represented by an sObject variable in the flow.

 

Cross-Object Field References in Flows: Polymorphic Relationships

Some fields have relationships to more than one object. We call these relationships polymorphic. For example, if you have queues enabled for cases, a case owner can be either a user or queue. If you’re traversing from a case to its owner ID, add special syntax to identify which object you mean when you say “Owner”.
Available in: both Salesforce Classic and Lightning Experience
Available in: EnterprisePerformanceUnlimited, and Developer Editions
To reference a field on a related record, use this syntax.

1 {!sObjectVariable.polymorphicObjectName1:specificObjectName2.fieldName}
where:

  • sObjectVariable is the unique name for the sObject variable that you want to start from.
  • polymorphicObject is the API name for a polymorphic relationship for sObjectVariable‘s object type.
  • specificObjectName is the API name for the object that you want to select from the polymorphic relationship.
  • fieldName is the name for the field that you want to reference on the last object in the expression. All custom field API names end in __c.

For example: {!sObj_Case.Owner:User.Id} references the ID of the user who owns the case, while {!sObj_Case.Owner:Queue.Id} references the ID of the queue who owns the case. You can always add the polymorphic reference after several traversals ({!sObj_Case.Account.Owner:User.Id}) or in the middle of a reference ({!sObj_Case.Owner:User.Manager.Id}).

Supported Polymorphic Relationships

Not every relationship is polymorphic, so we recommend using the polymorphic syntax only when you know that the field can link to multiple objects. The following relationships are supported.

  • Case.Source
  • FeedItem.CreatedBy
  • Object.Owner

    Where Object lets you set Owner to either a user or a queue. Group.Owner and Queue.Owner aren’t supported.

When you create an sObject variable to reference fields on related records from, store the ID for the first related record in the variable. For example, to reference an opportunity’s contract, store ContractId in the sObject variable or add a value for ContractId by using an Assignment element.

 

Example Cross-Object Field References in Flows

This example demonstrates how to update a contract’s owner to be the contract’s account’s owner.
Available in: both Salesforce Classic and Lightning Experience
Available in: EnterprisePerformanceUnlimited, and Developer Editions

Example

Example of a flow that references cross-object fields

  1. Use a Fast Lookup element to store the contract’s fields, including AccountId, in an sObject variable called varContract.
  2. Use a Decision element to verify that the value of AccountId was set in varContract.
  3. Use a Fast Lookup to store the fields for the contract’s account, including OwnerId, in another sObject variable called varAccount.
  4. Use a Decision element to confirm that the value of OwnerId was set in varAccount.
  5. Use an Assignment element to specify {!varContract.Account.OwnerId} as the value for {!varContract.OwnerId}.
  6. Use a Fast Update element to write the values in varContract, including the updated OwnerId value, to the contract in Salesforce.

Examples:

Opportunity Owner Name

Formula: {!sobjOppty.Owner.FirstName} & " " & {!sobjOppty.Owner.LastName}

 

Reassigning Email to Case to User who Forwarded Case to Salesforce

Business Use Case

Bobby DoRight is working as a System administrator at Skeletonforce.  He receives a request to have Cases created using from emails automatically assigned to the user who forwarded the email from outlook.At Skeletonforce, end users receives support emails directly from their clients in Outlook.

If Bob was follow the instructions in “Set Up Create Case for Salesforce for Outlook Users”, Bob would need to create individual Email to Case routing addresses for each user. He would then group 10 Email-to-Case destinations into functional group and assign them through Outlook Configurations. Users then select their name from the CREATE CASE button in outlook. This is confusing for the end user and a maintenance nightmare for Bob to keep track of. … there has to be an easier way.

Solution

Luckily for Bob, Salesforce stores the From Address for all Cases created from email. This stored information along with PROCESS BUILDERS and FLOWS will allow Bob to automatically reassign cases based matching the from email address with a user’s email address.

Objects & Fields Used

Object Fields
Users Id
Users Email
Case Id
Case OwnerId
Email FromAddress
Email ParentId

Process Builder

Settings Reference Image
Object Case (Create and Edit)
Criteria Specify Specific Recordtype and or Queue ownership

IsNew()

PB011718_001

PB011718_005

Scheduled Actions

0 hours after last modified date

Trigger Flow

– Pass Case.Id to varCaseId

PB011718_003

PB011718_002

PB011718_004

Flow

FL011718_001

Settings  Object  Criteria Reference Image
Fast Lookup Email Emails with Case Id

FL011718_005

Decision HasEmail sobjEmail is not null

FL011718_011

FL011718_006

Fast Lookup User User with matching email

** Not really needed

FL011718_009

Assignment Case case.ownerid equals user.id

FL011718_004

Fast Update Case

FL011718_012

## Testing

Test in a sandbox, not in Production.

Continue reading “Reassigning Email to Case to User who Forwarded Case to Salesforce”

Action Plans …. Reinvented Using Flows

INTRODUCTION:

If you have been using Salesforce for awhile, you may installed and used Action Plans by Salesforce Labs to automate standardized/repetitive processes. This appexchange app was and still is a very useful addon for any Salesforce instance. Customizing Action Plans to meet specific project needs while still keeping it’s simple universal appeal can be problematic. Especially if you are not comfortable with making changes to multiple APEX modules and VISUALFORCE pages.

Process Builders and Visual Flows to the rescue:

One of the best gifts Salesforce ever provided Administrators are Process Builders and Visual Flows. These two autmation tools allow users to automate Salesforce instances without needing a Salesforce Developers.

Business Need: Skeleton Bob has been asked to create a process that will allow product specific onboarding/change procedures. These procedures will consist of specific task to be completed by both non-Salesforce users and Non-Salesforce users.

After working with the line of business, Bob defined the resuable task templates, assigned user and/or teams for each product. He tried to use Action Plans, but the business line needed to many changes specific to them that would have changed Action Plans users in other line of businesses. Bob instead mimics Action Plan’s design using new objects and extends functionality with visual flows.

Design Components:

 

Design Components:

Note: A new blog post will be used for each component’s details

  • Objects:
    • Action Plan Flow Templates
      • Action Plan Flow Template Tasks
      • Action Plan Flows
        • Action Plan Flow Tasks
        • Links Parent Accounts
  • Custom Settings:
    • Action Plans Settings
      • Chatter Brag
      • Unassigned Tasks Defaults to Record Owner
  • Process Builders:
    • Action Plan Flow Template Task – PB
    • Action Plan Flow – PB
    • Action Plan Flow Task – PB
    • Task – PB
    • PARENT ACCOUNT
  • Visual Flows:
    • Action Plan Flow Template – Autolaunched Flow
    • Action Plan Flow Template Add Edit – Screen Flow
    • Action Plan Flow Template Task – Autolaunched Flow
    • Action Plan Flow Template Task Add Edit – Screen Flow
    • Action Plan Flow – Autolaunched Flow
    • Action Plan Flow Add Edit – Screen Flow
    • Action Plan Flow Task – Autolaunched Flow
    • Action Plan Flow Task Add Edit – Screen Flow
    • APFT Task Dependencies – Autolaunched Flow
    • APF Task Dependencies – Autolaunched Flow
    • APF Add Case Teams – Autolaunched Flow
    • APF HTML Emails – Autolaunched Flow

 

Associating Holidays With Business Hours

There are two ways to associate business hours and holidays.

Method 1 – Associate Business Hours Via Holidays

  1. Navigate to Setup | Administer | Company Profile | Holidays.
  2. Click on the holiday from the Holidays list
  3. It will open the Holidays detail page.
  4. Click on Add/Remove from the Business Hours list.
  5. In addition, add any Business Hours as per your needs.

Method 2 – Associate Holidays Via Business Hours

  1. Navigate to Setup | Administer | Company Profile | Business hours.
  2. Click on the Business Hours option from the available list:
  3. It will open Business Hours detail page.
  4. From the Holidays list, click on the Add/Remove button.
  5. It will redirect you to the next screen where you can associate the current business hours with multiple holidays:

Set Up Support Holidays in Salesforce.

Use Case:

Holidays let you specify the dates and times your customer support team is unavailable. After you create a holiday, you can associate it with business hours to suspend business hours and escalation rules during holiday dates and times. (Set Up Support Holidays)

Limits:

There are a few guidelines to keep in mind as you set up and work with holidays. (Guidelines for Creating Support Holidays)

  • Each set of business hours can associate up to 1000 holidays.
  • Holidays automatically acquire the time zone of the business hours with which they are associated.
  • You can only add business hours marked as Active to holidays.
  • Holiday names don’t need to be unique.
  • Currently, report results do not take holidays into account.
  • If you schedule a holiday to recur on a specific day of every month, the holiday will only recur on months that have that specific day.
  • Holidays that fall on a weekend
  • All users can view holidays via the API.

Setting up the holiday settings

To set up the holiday settings for your organization, follow these steps:

  1. Navigate to Setup | Administer | Company Profile | Holidays 
    or From Setup, enter Holidays in the Quick Find box, then select Holidays.
  1. Click on the New button or click Clone next to the name of an elapsed holiday .
    New Holiday.PNG
  1. Enter the following fields
    1. Holiday Name,
    2. Description,
    3. Date,
    4. Time fields.
    5. Recurring Holiday checkbox
      1. Frequency,
      2. Start Date,
      3. End Date fields
        Recurring Holiday.PNG
  2. Click on Save

 

 

Awesome Admin: Lightning Challenge – Day 10

 

Challenge: Share your favorite lightning feature!

Answer:

Hands down my favorite feature in Lightning Experience is the App Builder. (Followed closely by the new modern dashboards.)

Building on a known infrastructure with reusable components (out-of-the-box components & custom), the App builder allows #AwesomeAdmins to do so much more is less time.

With great power comes great responsibility. Gather the business need/customer stories. Take a step back and design solutions to accommodate as many business units as possible. Build today with an eye on the future.

 

 

Awesome Admin: Lightning Challenge – Day 9

Challenge: Create a new Lightning app page and assign to an app

For this challenge we revisit the same concepts we have covered in the previous posts.

Sample Solution:

  • Setup
  • Enter App Builder in the Quick Find box,
  • Screen 1
    • Select Lightning App Builder.
    • Click New.
    • Select App Page
    • Click Next
  • Screen 2
    • Select Main Column and Sidebar
  • Screen 3
    • Type Name
    • Click Finish
  • Add components as required
  • Activate
    • Page Settings
      • Assign a Name
      • Icon
      • Activate for Select Users
    • Lightning Experience
      • Add Additional Pages
    • Salesforce1
      • Add pages to Salesforce 1 App
  • Assign App Page to App
    • App Manager
      • New Lightning App
      • App Details & Branding
        • Name
        • Description
        • Icon
        • Color
        • Click Next
      • App Options
        • Click Next
      • Select Items
        • Select your newly created app page
        • Add any other pages needed
      • Assign to user Profiles
        • Select which profiles will use the app

And as always … test the final result.