Gorav Seth

Salesforce MVP (HOF) | Permaculture designer

Read this first

Expresiv application in Salesforce user login history

cleaning up our integration user, and found a large number of logins from a mysterious application named “Expresiv” with an AWS IP address.


a few posts on salesforce forums over the years, mostly very old

i had a hunch, that turned out to be correct, that in my case these came from old formassembly forms that were connected via basic auth (un / pwd / token) instead of the new (c 2014) oauth option.

so now i gotta track these down and update them bc basic auth is no bueno.

View →

checking for record access in visual workflow

the UserRecordAccess object “Represents a user’s access to a set of records”.

in apex, you can query this object to determine if a user can view, edit, delete, share, or transfer a record.

SELECT RecordId, HasReadAccess, HasTransferAccess, MaxAccessLevel
FROM UserRecordAccess
WHERE UserId = [single ID]
AND RecordId = [single ID]

in flow, you can query this object to test for edit before updates, in theory, but its got some quirks because it has very specific requirements around how the query is structured, and the standard flow “get records” element does not meet them.

the docs specify these requirements for the query. the 2nd and 3rd ones come into play here.

SOQL restrictions:

  • When the running user is querying a user’s access to a set of records, records that the running user does not have read access to are filtered out of the results.
  • When filtering by UserId...

Continue reading →

tracking number of simultaneous users in salesforce

in setup - session management, you can filter to see session where
SessionType = UI
ParentSessionId = null

and those are your currently logged in users.

i needed to track that over time, to see what our numbers look like for internal purposes.

i wanted to track this every 30 mins, to capture spikes. we have session length set to 2 hours, so that clears out inactive sessions reasonably fast.

so via flow i could get records of the authSession object, but scheduled flows are max 1x/day, without hackery. didnt want to write any code for this, so went to power automate.

was very easy to setup a get records to query salesforce, and then write the number of simultaneously logged in users to an excel online file. and power automate lets you schedule to run very frequently, even in seconds. so every 30 mins is no issue.




Continue reading →

using flows in system mode allows for alternative approaches to changing ownership

The standard sharing button and change owner button are great for hierarchical organizations, as the ‘power’ magically flows up the role hierarchy - so bigger fish higher up the role hierarchy can change owner / share records of all the little fish underneath them.

this is not so great when there is a high degree of collaboration within roles. in my case, each role represents a country office and country offices are collaborative entities. anyone in the country office should be empowered to change the owner of a contact owned by anyone else in the office, without asking the current owner.

while the standard ‘change owner’ functionality is carved in stone cannot be overridden, you can add a custom button and a flow in system mode that allows for alternative models like this.

its quite simple. the flow runs in system mode. it checks if $user.role = owner.role, and if so, lets them...

Continue reading →

using screen multi-select choice in formula uses label not value

sorry the images turned out huge and this article is hard to read

if you reference a screen multi-select choice element in a formula, the formula uses the choice label, not the choice value.

choice with value defined

Screenshot from 2021-06-21 13-08-24.png

choice is used in screen multiselect checkbox group :

Screenshot from 2021-06-21 13-11-05.png

formula field references screen field

Screenshot from 2021-06-21 13-01-23.png

output uses choice labels


but, if you first assign the screen field to a variable, and use the variable in the formula, then you get the values.

assign screen field to variable


formula uses variable


output uses choice values


feature or bug…you decide!

Continue reading →

email to case auto-responder and contact emails

Email to case matches on all email fields, including custom email fields.

However, if email to case finds a matching contact, the auto-response email appears to always include the contact’s preferred email, which is problematic if one thinks about it for a few nanoseconds. Contact submits a case from email abc and the autoresponse is sent to email xyz (and also email abc, if you check the box to copy all email addresses on the autoresponse).

There is now an easy declarative way to remove the contact from the case, using before-save flows, which fires before the auto-response rule!

The flow needs to set case.contactId and case.preferredEmail to blank (global constant empty string). I assume both are required, did not test them independently.


Continue reading →

translation workbench is a dumpster fire

i just spent an hour trying to get an import file working, because translation workbench…

the documentation ON THE IMPORT PAGE says

Include the language attribute at the top of the file. Your format should look like Language = “en_US” and include a valid language reference.


Nice, if it was true, but its complete fabrication. It makes not a single iota of difference if it is there or not or filled with garbage.

What is required, is the following

Language code: [valid language code]
Type: [source | bilingual | data]

I spent a freaking hour trying to do shit with Language = xyz, making sure my file is utf8 etc etc etc. What garbage.

So this worked fine

Language = "dumpsterfire"
Language code: es
Type: Source


CustomLabel.FD_GAR  I am a Sucker


Continue reading →

Evaluating isSandbox in flow

In Summer 14, Salesforce added the isSandbox boolean field to the Organization object that can be easily queried in apex.

In flow, process builder, and workflow rules, you can access the $organization global variable via a formula field, but a number of fields are missing, including isSandbox

You might think you could hard code the org Id but it wont work, due to magical mysterious things that happen in the sandbox refresh engine, which will update almost all references to the new sandbox org id.

In flow, it is quite easy however to get this info via a get record element. Do a get records on the Organization object (all records), then you can access the isSandbox field, and evaluate it in a decision element.

Get Records

Decision Element

Sadly, this is not available for process builder or workflow rules and my idea for this only has 3 votes in two years, flow is the future…


Continue reading →

Embedding a PDF on a formassembly form

Some folks needed a form that had an embedded pdf for review. I was hoping to find something that works on desktop, and works or is at least not a total disaster on mobile.

Found the pdfobject js library : https://pdfobject.com/ which seemed to know a bit about the subject. Tried all the ‘static’ / pure html approaches, and discovered the formassembly blocks the tag which otherwise worked perfectly well. Note - you can actually save a form w the object tag, but it will disappear the next time you open it. Support says they will work on blocking it better soon

So tried out the js approach, and it worked out well. Works great on desktop and displays the ‘fallback’ option to download the pdf on mobile devices that do not support embedded pdfs.

Here is how to do it

To start, create a form with two sections, and one text area in each section. Make the second section a hidden...

Continue reading →

Evaluating max/min of multiple date fields in flow

I have 3 date fields on an object and i need the MIN of the 3. But the MIN formula function does not allow dates, just numbers

IF could work for up to 3, and there are some solutions out there using formulas, but seemed fragile / complex.

So, solved via flow

  1. create a variable, type = date; name it vaMinimumDate

  2. use an assignment element to add all the date fields from the object to a collection variable (doesnt matter if the dates are null or not)

  3. loop over the collection variable

  4. in the loop, use a decision to evaluate if the current loop variable is less than vaMinimumDate



To test if the date field is blank/null, create a formula field, type = date, value = NULL, and then in the decision you can test equals/not equals formulaField.


The outcomes in the decision need to be in this order
a) is loop variable null - if so, pass on this iteration
b) is...

Continue reading →