Logo

Tag Archive for workaround

Symbols That Sort After “Z”

Why would you want a symbol that sorts after “Z” in ascending order?  Well, here is an alternate title:  How To Place the Summary or Total Row Last or at the Bottom of the Table.

I’ve run into the scenario multiple times where I am creating a total or subtotal row that summarizes the other rows in the table.  This is also something I’ve done if I have a bar chart and want one of the bars to summarize the rest.  If I leave it alone or force a “-” symbol before and after, like “- Total -” it actually places this at the very top of the table.

q1 = load "DTC_Opportunity_SAMPLE";

q1 = group q1 by 'Opportunity_Owner';
q1 = foreach q1 generate 'Opportunity_Owner' as 'Opportunity_Owner', count() as 'Count';
q1 = order q1 by ('Opportunity_Owner' asc);

z1 = group q1 by 'Opportunity_Owner';
z1 = foreach z1 generate "- Total -" as 'Opportunity_Owner', sum(sum('Count')) over([..] partition by all) as 'Count';
z1 = limit z1 1;

q1 = limit q1 2000;
q1 = union z1, q1;

q1 = group q1 by 'Opportunity_Owner';
q1 = foreach q1 generate 'Opportunity_Owner' as 'Opportunity_Owner', sum('Count') as 'Count';
q1 = order q1 by 'Opportunity_Owner' asc;

The end result is a table with the summary total at the top:

Opportunity Owner Count
– Total – 671
Bruce Kennedy 41
Catherine Brown 38
Chris Riley 47
Dennis Howard 30
. . . . . .

Sometimes we want the Summary or Total row to be at the bottom, or the summary bar (in the case of a bar chart) to be last.  We want the summary row last while still keeping the remaining rows sorted in ascending or alphabetical order.

How To Place Summary or Total Row Last / At the Bottom

Now it would be easy to place the total row at the bottom if we just change the last line of code to ‘desc’ instead of ‘asc.’  The problem with this approach is that it would sort all of the names in descending order and they would be in reverse alphabetical.

Another approach is to reorder the union so that z1 is listed second instead of first.  However, if you need to re-project after the union as you often need to do this does not help.

The solution here is to place a symbol that sorts after z as the text of the ‘Total’ row and leave it sorted in ascending order.  According to a post on stackoverflow, here are some symbols that sort after z:

  • Ω (option+z)
  • π (option+p)
  • µ (option+m)

Reference: Symbols that sort after z

If we place one of these symbols at the beginning of the name instead of “- Total -” it will ensure that the row always sorts last.  Even better, you can place it into a new “helper column” named ‘Sort’ and use it to sort and then discard it at the very end:

q1 = load "DTC_Opportunity_SAMPLE";

q1 = group q1 by 'Opportunity_Owner';
q1 = foreach q1 generate 'Opportunity_Owner' as 'Opportunity_Owner', 'Opportunity_Owner' as 'Sort', count() as 'Count';
q1 = order q1 by ('Opportunity_Owner' asc);

z1 = group q1 by 'Opportunity_Owner';
z1 = foreach z1 generate "- Total -" as 'Opportunity_Owner', "ΩTotal" as 'Sort', sum(sum('Count')) over([..] partition by all) as 'Count';
z1 = limit z1 1;

q1 = limit q1 2000;
q1 = union z1, q1;

q1 = group q1 by ('Opportunity_Owner','Sort');

q1 = foreach q1 generate 'Opportunity_Owner' as 'Opportunity_Owner', 'Sort' as 'Sort', sum('Count') as 'Count';
q1 = order q1 by 'Sort' asc;
q1 = foreach q1 generate 'Opportunity_Owner' as 'Opportunity_Owner', sum('Count') as 'Count';

This results in a table as we would expect:

Opportunity Owner Count
Bruce Kennedy 41
Catherine Brown 38
Chris Riley 47
Dennis Howard 30
. . . . . .
– Total – 671

 

To summarize, we are using one of the symbols that sorts after “z” in the name of a new column and then sorting by it to ensure that this row is always last.  Then, we discard that column so you never know it was there!

Let me know your thoughts, comments, suggestions or other workarounds you’ve found to present the data to meet the needs of your users!

Can’t Clone Date or Range Widgets – Multiple Pages Workaround

Date or Range Widgets – The Problem

I wanted to create an interactive, multiple page dashboard like the one below:

The issue is that I wanted the same date widget to be accessible on every page as your user may want to modify the dates at any time.  Typically, you can create all of the widgets (containers, numbers, charts, lists/dropdowns) on a single page and then select them to add them to other pages, as below:

The problem is you cannot do this with Date widgets.  As of Winter ’19 (in a pre-release org) you get an error message that states: “Warning! Can’t clone Date or Range widgets.”  hmmmm….OK

Warning! Can't clone Date or Range widgets.

Warning! Can’t clone Date or Range widgets.

As the video demonstrates above, the “Add to Page” feature works fine for dropdown lists for use in faceting or bindings along with many other widget types but not for dates…

Workaround #1 – Clone Entire Page

If you are lucky enough to place the date widget onto the main page and set it up prior to creating your additional pages you can just clone the entire page and your date widget will be cloned (despite the error message) onto every page using not only the same step but the same widget (a linked widget just as you would expect).

Date Widget Is Linked!

Of course, this is only an option if you have not yet created your additional pages. In my opinion, it is the preferred workaround because it create a truly ‘linked’ widget and changes to the widget will not have to be manually replicated onto additional pages.  Additionally, it is a no-code workaround which is another plus for many.

Workaround #2 – Update Steps

This workaround consists of creating a second, third, … (as many as necessary) date widgets for each additional page required in your dashboard.  Then, you will update the JSON to point these new date widgets to the original step that the original date widget is using from page 1.

After creating the date widget onto the canvas, actually set up the underlying step by clicking on the “Date” link and selecting a dataset and date field.  You can choose any date field because we will be updating the underlying step manually in a minute.

This step of actually setting up a step is necessary because you cannot drag the date step from the list of steps to the date widget.

Can’t drag date step to date widget – I guess that’s why it’s italicized!

Now that we have the original date widget and step from page 1 AND all of the additional date widgets on subsequent pages we CMD+E or Ctrl+E into the JSON!

Locate the original date widget and step from page 1 (you can also click on the widget prior to accessing the JSON and view the details there).

In this case I can see that my widget from page 1 is using the step “Last_Activity_1”.  You will want to save this value because we want to update the date widgets from the other pages to also use this step.  Once you have located the other date widgets and the steps they currently leverage you can update them.

I like to use the Find & Replace tool that is hidden until you CMD+F or Ctrl+F twice (that’s right, use the same keyboard shortcut twice in a row!  Magic!).  Now it’s simply a matter of finding the incorrect values and replacing them with the correct value.

Once I have replaced all of them (only the ‘Step’ values), the widgets are linked to the same step and the user can now update the date widget on any page and their selection will persist while navigating to any other page.

Have you encountered this before?  I suppose a third workaround may be using code to actually add the same widget (linked) onto each page through JSON however this would be a lot more work for virtually the same result.

How long will we have to live without the ability to drag date steps to the widget or use the Add to Page functionality for date widgets? (Even though we can currently clone the entire page with the date widget included).  Let me know your thoughts and your best Einstein Analytics workarounds in the comments!

Copy Salesforce Matrix Report & Other Tables Into Excel Without Check Boxes

Salesforce Quick Tips

Copy Salesforce Matrix Report Into Excel

As much as we’d like to keep and share data in the cloud it’s sometimes necessary to take your salesforce data and place it in a spreadsheet to share with others.  You can always export the detail view (tabular view with one row per record) into a .csv or .xls format.  However, sometimes it’s beneficial to be able to take your summarized matrix view and paste directly into Excel.  Especially in cases where you may have written a lot of complex report formulas (these don’t export unless you use “Printable View”) or added other aggregations: sum, min, max, avg.  In order to replicate in Excel you would need to create a pivot table on the detailed export.  Why rebuild if you don’t have to?

Check Boxes: The Issue With Copying and Pasting From Salesforce Matrix Reports

The primary issue with copying and pasting from Salesforce matrix reports is that the copy/paste includes the checkboxes on the left side of the table.  I’ll show you how to get rid of those pesky boxes and copy/paste like a pro!  Note – you can also use the “Printable View” button, however this trick works in a pinch and works for more than just reports as noted below!

Salesforce Matrix Report

Step 1: Copy the entire table as displayed below.

Copy Salesforce Matrix Report Cells

Very important to copy every cell, so start above the table if necessary to ensure you’ve copied the first and last cells.

Make Sure to Copy From Above Report Results

Step 2: Ctrl + c to Copy!

Step 3: Paste into Excel.

Paste Salesforce Matrix Report in Excel

Salesforce Matrix Report In Excel…not pretty!

See the checkboxes in column A?  You can delete the column or try selecting them with your mouse, and still you won’t be able to remove them using those methods!  We’ll show you how you can select the checkboxes, so you can remove them!

Step 4: Press F5 and click “Special…”

F5 In Excel Click Special

Step 5: Select “Objects” and click OK.

Select Objects and OK

Step 6: Now the checkboxes are selected, so hit the “Delete” key on your keyboard to get rid of them!

The Check Boxes are Selected and Delete

Step 7: Now the formatting needs some work.

Fix Excel Formatting

Step 8: Remove Column A.  Fix colors, borders, font and size.  Now you have one version of a Salesforce Matrix Report in Excel without the check boxes!

Final Excel Table Copied From Matrix Report in Salesforce

Other Salesforce Tables

This trick also works for other Salesforce tables that you want to copy and paste from, like a list of standard or custom fields on an object:

You can just highlight, copy & paste and then use the trick above to remove the “Indexed” fields and/or check box images.

Conclusion

This saves you time from rebuilding and ensures accuracy (no more copying and pasting individual #’s).  You can keep the formulas and summaries that you worked so hard to build in Salesforce and get them into Excel for your users who need them presented this way.  Please remember to also try the “Printable View” button which also may meet your needs, however it won’t work for lists of fields and other tabular data out of your Salesforce org!  Do you have any other tips and suggestions for working with Salesforce reports in Excel?  I would love to hear them!  Comment below or tweet them @SFDC_r!

Avoid Long Load Time To Edit Dashboard Component Report

Salesforce Quick Tips Edit Dashboard Component Report

Edit Dashboard Component Report

Have you ever wanted to edit the underlying report for a dashboard component and found it cumbersome?  A dashboard executes with a ‘running user’ and this user feeds into all of the underlying reports.  This is great, because it means that you can create a single set of reports and not have to edit the reports for the dashboard to provide useful data to an entire set of your users.

The Problem – Edit Dashboard Component Report

Because your user is likely placed very high up in the role hierarchy (so that you have access to all or most of the Org’s records) when you click on a dashboard component to view the underlying report, it can take many minutes (or even timeout).  Your users don’t have this issue, they click the dashboard component and the user running the report would only see records at or below them in the role hierarchy – likely running quickly.  You as the admin, however, can only finally click “Customize” to edit the report after waiting a long time (and that’s if it doesn’t timeout).

The other option to avoid the above dilemma (and wait) is to navigate to “Reports” and locate the report you want to edit.  Instead of running the report, click the arrow and “Customize.”  The issue here is that you have to know which report you want to edit, which probably requires “Editing” the Dashboard to view the exact name of the report for the specific component.  This can be time consuming and cumbersome as well.

A Better Solution – Salesforce Quick Tip!

I present to you a better solution.  Simply right click the Dashboard Component you would like to edit the underlying report for and copy the URL.  Paste the URL into your browser (probably a new tab) it should look something like this: https://[YOURSERVERURL].salesforce.com/00O61000003p9Nj if it happens to have anything after the Report ID – just remove it so it looks like the above.  Now add “/e?” to the end of the URL.

Final URL: https://[YOURSERVERURL].salesforce.com/00O61000003p9Nj/e?

Problem Solved

Now just hit Enter and you will be taken directly to editing the underlying report – and it will load quick.  Never get stuck waiting for a report to load just to edit it!

What quick tips do you have related to Dashboards or Reports?  Feel free to post in the comments or on Twitter!

Future-Proof Your Org w/ a Relative Salesforce Server URL

Salesforce Quick Tips Logo

Use A Dynamic/Relative Salesforce Server URL

Today, I’m going to show you how to future-proof your Salesforce server url.  Instead of specifying a specific Salesforce server, we will use a relative Salesforce server URL.  What does that mean exactly?  Well, have you ever created hyperlinks used in many email templates that point to a page within Salesforce?  Are they “hard links” that point to a specific Salesforce server, “https://na30.salesforce.com/” for example?

If Salesforce moves your org to a different server, you will have to go into each and every email template and make the change!

The Solution/Workaround – Relative URL’s In Email Templates

Create a formula field on the User object using the following formula:

LEFT($Api.Enterprise_Server_URL_270, FIND( "/services", 
$Api.Enterprise_Server_URL_270) -1)

Then, use this field whenever you need to reference the Salesforce Server URL.  If Salesforce moves your org to a different server, no changes necessary!

Do you have any other tips for future-proofing your org?  Post in the comments or message on Twitter!

Also check out the Go With The Salesforce Flow series!

Go With The Salesforce Flow – Using Multi-Select Picklists

Salesforce Flow Series

Using Multi-Select Picklists Within A Flow

Have you ever tried using multi-select picklists within a Salesforce Flow?  Did you update the picklist field with a new value and instead of adding the new value it replaced the existing value(s)?

I’ve found this to be a very unintuitive aspect of Salesforce Visual Flow.  If you do it wrong, you update the multi-select picklist field with new values, but wipe out the already existing values.  I have good news, however, because today I will show you a workaround!

Adding, Not Replacing, A Multi-Select Picklist Value In Flow

First store the existing picklist values as a multi-select picklist variable in your Record Lookup step.

Multi-Select Picklist Flow - Store Variable

Ensure the variable is set to “Picklist (Multi-Select)” data type.

Multi-Select Picklist Flow - Variable Type

Use a “Multi-Select Picklist” field within a Screen Element for users to interact with.

Multi-Select Picklist Flow - Choice Field

Create a new choice to be used as the default and set it to the variable that was set in the Record Lookup step.

Multi-Select Picklist Flow - Create Default Choice

Now create a new choice for every option you would like to provide your user.

Multi-Select Picklist Flow - Create Desired Choices

After you are done creating the necessary choices, ensure you set the correct one as the default choice as shown on the “Screen” image above.

Now create a Record Update step to update the desired multi-select picklist field from the value in the screen field.

Multi-Select Picklist Flow - Update Record From Multi-Select Field

 

That’s it!  But, what if you want to update using a different type of Screen Element field?  Check out below to see how you would update with a boolean field.

Create a boolean field.

Multi-Select Picklist Flow - Boolean Field to Update Multi-Select Picklist

 

Then, after creating a Decision step to determine whether the user has checked the box, create an Assignment step.  The Flow will utilize this step only if the box is checked.  Here, I’ve used another variable to store the record’s current picklist values.  Ensure that you use the “Add” operator and that you add a semicolon before the picklist value.

Multi-Select Picklist Flow - Assignment Add And SemiColon

Now add a Record Update step to update the picklist value with the variable’s value.

Multi-Select Picklist Flow - Update Field From Variable

 

Now we’re ready to run through the entire process!  Check out the Opportunity below.  The Multi-Select picklist field “Topics” currently has the values: Purchasing & Accessories.

Multi-Select Picklist Flow - Opp With Two Values Selected

Our Screen Element properly displays those as the two chosen fields, and gives use two available choices: Warranty & Service.

Multi-Select Picklist Flow - Add Two Values

I’ve gone ahead and added both of them and click “Next” in the flow.

Multi-Select Picklist Flow - Add Two Values

The Record Update takes place, and if I refresh the Opportunity, I now see the additional values were added to the two already existing values.  It didn’t wipe out what was already there…perfect!

Multi-Select Picklist Flow - Refresh Opp Values Added

Now, in my Flow I reach the boolean checkbox.  I check and click “Next.”

Multi-Select Picklist Flow - Use Boolean for Repair

Now when I refresh my Opportunity and click into the Topics field I see the following in the box and just below it.  All 5 values have been selected within the field and only “Replacement” has not been selected.

Multi-Select Picklist Flow - Opp Adds Repair

 

There you have it, we were able to successfully update a multi-select picklist within a Flow using two different methods & fields (one requiring an assignment step).  We successfully updated the values without removing or replacing the existing values.  Way to go!

Check out the rest of the Go With The Salesforce Flow Series for more Visual Flow tips & tricks!

 

Go With The Salesforce Flow – How to Default the Current Picklist Value

Salesforce Flow Series

Salesforce Flow – How to Default An Existing or the Current Picklist Value

Have you ever wanted to use a dropdown list within a Salesforce Flow Interview Screen and have it dynamically populate with the current value of that picklist field?  Well I’m here to show you how!

First, make sure you store the current value of the picklist field in a variable within a Lookup step in your flow.  Here, I’m storing/assigning the current Delivery/Installation Status value to a variable.

Salesforce Flow Record Lookup

Then, on the desired screen where you would like to present this information, add a “Dropdown List” field.

Salesforce Flow Add Dropdown List

Now, you will want to give your users a choice between all of the available values of that picklist field.  Hint: using this method to add a choice future-proofs your flow so that even when available picklist values are changed your flow won’t need to be updated!  Within the choice settings section, select “Picklist Choice.”

Salesforce Flow Add Picklist Choice

Now you will choose the Object & Field where you would like to pull the available choices from.  Notice the spelling mistake “Piclist Choice Settings” – c’mon Salesforce!

Salesforce Flow Add Picklist Choice

Now let’s quickly recap what we’ve accomplished so far.  We’ve taken the current value of a picklist field and stored it within a Flow Variable.  We’ve also added a Dropdown List field to an Interview Screen and populated it so that our user can choose from all of the available picklist values from the same field.  If we stopped here, we would be storing the current value in a variable, but the Dropdown List on the Interview Screen wouldn’t automatically default to the current value.  The user could choose from any available value for that field but would not have any way of knowing what the current value on the record is.  See, I can’t set the Default Value!

Salesforce Flow No Default Option

The key to selecting a default value is to create another choice, this time just a standard “Choice.”

Salesforce Flow Create Default Choice

Now this is where it gets fun.  Instead of typing a static Label for this default choice, we are going to use the variable we stored so that it will always dynamically display the text of the current value.  We also want the variable’s value to be the “Stored” value of this selection so that if we update the record from this Screen Choice Field the correct information will be passed.

Salesforce Flow Create Default Choice

Now we are able to set the Default Value of our Dropdown List to this new default choice.

Salesforce Flow Screen Picklist Field

Here it is in action!  We have an Opportunity that has a current Delivery/Installation Status value of “In progress.”  If we interact with this Opportunity via our Flow, we would expect to see this value already populated.

Salesforce Opportunity

Sure enough, “In progress” is the selected value within our Dropdown List field!

Salesforce Flow Defaults to Existing Value

One important note: this method will actually create two choices that are exactly the same.  We created a choice that contains the full list of all available values for this picklist field, and then we also have the default/current value.  As you can see below, you see “In progress” twice.  It doesn’t matter which one you select, this field would pass the same value!

Salesforce Picklist Duplicated

 

Stay tuned as our Salesforce Flow Series continues with more tips & tricks!

How to get the MAX or Most Recent Date of several date fields in Salesforce Formula

Goal: Return the MAX or Most Recent Date of several dates

Recently I needed to get the most recent date of 4 separate date fields.  I created a new formula field and was shocked to find that MAX(custom_date_1,custom_date_2,custom_date_3,custom_date_4) did not work.  MYSQL allows MAX() to function for date fields and I was surprised it didn’t work here!

Workaround: MAX(DATE) Formula

The full formula example of the workaround is below.  An important aspect of the formula is to handle if any of the dates that are being compared are null.  Also remember to add DATEVALUE() for any fields that are of type DATETIME.

IF(
    AND(
        ISBLANK(custom_date_1),
        ISBLANK(custom_date_2),
        ISBLANK(custom_date_3),
        ISBLANK(custom_date_4)
    ),
    NULL,
    DATE(1900, 01, 01) +
    MAX(
        BLANKVALUE(
            custom_date_1, 
            DATE(1900, 01, 01)
        ) - DATE(1900, 01, 01),
        BLANKVALUE(
            custom_date_2,
            DATE(1900, 01, 01)
        ) - DATE(1900, 01, 01),
        BLANKVALUE(
            custom_date_3,
            DATE(1900, 01, 01)
        ) - DATE(1900, 01, 01),
        BLANKVALUE(
            custom_date_4,
            DATE(1900, 01, 01)
        ) - DATE(1900, 01, 01)
    )
)

I hope you find this helpful!

Salesforce – let’s have a date…and time! Date Fields Missing Time Workaround

System Date Fields Missing Time

You can’t go on a date without first setting a time, right?  Well, Salesforce has found a way to have system date fields missing time information!  Have you ever wanted to know the created date & time of a record within Salesforce reports?  How about sorting a list view in ascending or descending order based on the creation or last modified date?  Well unfortunately, even though these date/time fields capture both the date and the time, only the date is displayed in reports and views.  Thankfully there is a quick and easy workaround for this issue as outlined below.

Date Fields Missing Time – The Problem

Date Fields Missing Time Without Time In Salesforce List Views

Where has the time gone? Definitely not found in Salesforce list views and reports!

Date Fields Missing Time Without Time In Salesforce Reports

Date Fields Missing Time – The Workaround

Create a formula field and be sure to select Date/Time as the type:

Create Custom Formula for Date Fields Missing Time Without Time

For the formula result, select the System field you would like to retrieve:

Set Created Date as Formula for Date Fields Missing Time Without Time

In this case, we are wanting to pull in the Created Date & Time info.

Set Created Date As Formula Result for Date Fields Missing Time Without Time

Add the new formula fields to your list views & reports and enjoy!

Dates With Times Now In Salesforce List Views

There’s the time!  Now you can easily sort in ascending or descending order!

Dates With Times Now In Salesforce Reports

 

What other tricks do you have related to date/time fields?  Let me know in the comments!

Multiple tabs are your Salesforce friends!

I’m sure you leverage multiple tabs in your everyday web browsing life, but have you utilized them in Salesforce.com?  No, I’m not talking about (my 3-year-old son says, “but but but that’s not what I was talking about!) the objects you add to apps to display in the tab bar at the top of every page within Salesforce.  I’m talking about using multiple browser tabs.  I’ve found them to be instrumental in day-to-day administration and configuration of the platform.

For example, I’ve opened multiple browser tabs to quickly compare 5 or 10 page layouts and quickly used the keyboard to toggle between them rapidly to ensure all layouts include/exclude particular fields with the correct access (read-only) and placement.  Sure, I could have used a single tab and used the Salesforce drop-down to select the next layout and repeated 10x, but opening them all up quickly and then cycling through is much faster.

Multiple Tabs – Profile – Object Permissions

While editing profile permissions, I’ve opened multiple a tab of each profile in question and quickly toggled between them to compare and contrast.  Sure, I do know that the enhanced profile interface would let me add a new view with columns for each CRED on specific objects and view those for whichever profiles I want.  But this is honestly a pain.  I can only have 10 columns and each CRED attribute (Create, Read, Edit, Delete, View All, Modify All, etc.) take up a column.  I can maybe get two objects within a view and that takes time to build if you are leveraging many standard and custom objects including managed packages.  Not to mention you can’t add page layout or record type assignments to these views.

Below is a quick example of this.  I was not able to use my keyboard shortcuts while creating the GIF, so I just cycled through with the mouse.  The key here is to learn the keyboard shortcut so you can toggle through much faster, and focus all of your attention on the text.  Any differences will quickly jump out at you!  Once you are done cycling through the current objects on the page, hit space bar on each tab as you cycle through.  It will scroll the window down by the same amount on each tab so that they all line up perfectly for you to continue your review.  In this case the only difference is the Tab for Leads is “Default Off” for the Support Profile.

Use Multiple Tabs to Check Profile Permissions

Multiple Tabs – CRED – Field Security – Page Layouts & Record Types

From here I can open up multiple tabs for various objects to edit/review or open the same object but for various profiles (example below).  Here I can quickly see CRED permissions, field security, and page layout & record type assignments and make the necessary changes.

Use Multiple Tabs to Check Assigned Page Layouts Record Types And Object Perms

Multiple Tabs – Available Picklist Values for Record Types

This also comes in handy when quickly reviewing the available picklist values for different record types.

Use Multiple Tabs to Check Record Type Available Picklist Values

Admittedly, these examples are simple and I wasn’t able to cycle through as fast as you can with the keyboard.  It may seem that you could just as easily accomplish a simple task with a single browser tab/window.  But what if you had 10 different picklist fields to compare for 10 different record types?  Using multiple tabs can help you quickly and efficiently review settings across the platform and make changes if necessary.

How do you leverage multiple tabs in your Salesforce Administration?  Would love to hear your comments!