Gorav Seth

Salesforce MVP (HOF) | Permaculture designer
Me on Mastodon

Read this first

flow http callout and transform element

in preparation for a user group session with peter churchill re extending flow with http callouts and lwc for a dc user group meeting, i tested http callout and external services against the petfinder api, developer.trade.gov consolidated screening list api, and the boldsign api. my notes and observations re http callout and transform element are below. peter figured out a bunch of cool things

One of the first decisions to make is whether to use http callout or use external service. My conclusion is that if the endpoint provides an open api spec, it is easier to create an external service and select the methods you need in the flow, for the following reasons:

  • when you create a http callout action, you paste in the response and then salesforce parses it. in this process, you have to go through and manually set the types (string, date, boolean, etc) for any properties that the...

Continue reading →


Making cases work in lightning

I couldnt find any clear documentation on how to get cases to just not be total crap in lightning. Tried many times, and failed miserably. finally found a way through lots of googling, and piecing things together. the short answer is that you need feed filters and a console app and then there is hope.

“Enable Case Feed Actions and Feed Items” in support settings

  • otherwise you may find odd stuff with things not showing up in the case feed esp on old cases

setup case feed filters

  • can setup feed filters in classic, to determine what is on the page
  • feed filters only show up in console apps in lex, but actually make it usable. you can see all the emails, and easily move from one to the next. other normal things

try “Enable Unread/Read on Compact Case Feed” - no idea what that does yet…and maybe ‘enable draft emails’ cuz why not.

create a console app, then do normal lighting...

Continue reading →


exporting field help text and description in bulk

TIL that you can create custom report type on entity definition + field definition to report on your fields!

h/t : https://www.asagarwal.com/how-to-report-on-objects-and-fields-defined-in-salesforce/ and Anna Loughnan

However I could not include field help text, though it is listed in the tooling api docs for fielddefinition

then i tried a custom report type on entity definition with entity particle, and added field definition via lookup

this worked in theory - i could include description and inline help text.

but when i ran the report, field description remained blank. other folks said the report type worked for them, so i should test more as the report types would be really simple to use. so try that first.

instead I ran a soql query to test it out, and this works

select entitydefinition.label, inlinehelptext,fielddefinition.description,fielddefinition.label from...

Continue reading →


using vscode to fix reports that break from configuration changes

changes to configuration, like updating picklist values, can easily mess up salesforce reports, which is a perennial problem for yours truly. i think sometime in the middle ages i dealt with this using eclipse but only vague memories remain.

working today on using vscode to deal with this…first I needed to get all reports locally.

this post on dev forum suggested a nifty package generator extension

I used that extension to generate the package. check the “report” metadata type and it crunched through all 6k(!) reports we have and created a package.xml file

packagexmlreports.png

then i could easily retrieve all reports by right clicking on the package.xml file and selecting “retreive source from org using manifest” in vscode!

retrievesource.png

i then used find/replace in folder to update the old picklist value to the new one! but if I then use force:source:push it deploys all reports, not just the modified ones.

I...

Continue reading →


refreshing sandboxes when direct login is blocked

edit : looks like the link in the sandbox refresh success email already has the right url to allow you to login with username and password.

file under stupid workarounds that cant possibly exist in a 50B platform

if you use single sign on in prod, and block login from login.salesforce.com because security and all, refreshing sandboxes becomes a stupid pita because the new sandbox inherits the ‘block login from’ setting,

therefore after refresh is complete, you click ‘login’ in the sandbox list from prod, and it takes you to the direct url to login (ie cs13.salesforce.com)

enter your pwd and you get this helpful message

Please check your username and password. If you still can’t log in, contact your Salesforce administrator.

To fix this, you have to manually craft the mydomain url for your sandbox. this is formatted as

prodMyDomain–sandboxName.sandbox.lightning.force.com

in my...

Continue reading →


updating sort order on campaign member status

quick note re updating sort order on campaign member status

you cant do this via the UI, you have to do a data load

and sort order is unique, you cant set a member status to have a sort order of 2 if another one already is 2.

so lets say you have 10 member statuses, with sort order 1-10.

if you want to update them, query via workbench

select id,label,sortOrder from campaignMemberStatus where campaignId = ‘insert ID of your campaign here’

then to update the sort order, you need to set the new ones starting with 20, so you have 20-30

then the update will work

else you will get an error

View →


flow rich text email with list of records

Spring21 brought us rich text emails in flow, which made it fairly simple to create a nice looking email that includes a list of records. throw it in a scheduled flow and you have some serious potential. add a link to a report with inline editing enabled and you have black belt ninja material!

my use case : send opportunity owners a list of their open opportunities that have passed the close date.

here is the full flow
fullFlow.png

will break down each piece below

Schedule: the flow is scheduled on the user object, and fires for all users where isActive = true (if the owner is inactive, nobody will be notified. I would handle these through a separate process.)

getOpportunities: get all opportunities, where ownerid = $record.id (the user from the scheduled flow) and closeDate is less than $flow.current date

getReport: In the email, I include a link to a report so they can edit it using...

Continue reading →


bulk deleting reports from salesforce

i swear i used to have a way of deleting reports via the metadata api in bulk many years ago but i could not get that to work

this works:

query reports via workbench to csv

run delete - but not via bulk api - as delete operation not supported on bulk api

so you can do about 1-2 k at a time, vs the native interface which gives you 250, so its better

works for private reports also by adding using SCOPE allPrivate (and ensuring you have the perms to do so) see : https://help.salesforce.com/s/articleView?id=000317823&type=1

works for reports

SELECT Id, Owner.Name FROM Report USING SCOPE allPrivate WHERE Owner.IsActive = false limit 1200

and for dashboards

SELECT Id, RunningUser.Name, Title FROM Dashboard USING SCOPE allPrivate WHERE RunningUser.IsActive = false limit 1200

Continue reading →


truncating case description in case assignment email

sure its 2022 and we have force lightning powers that emperor palpatine himself could only dream of, but if you want a good case assignment email, you need visualforce.

i rolled up a nice visualforce email template years ago that includes the case commments - sorted by date!

but the template includes case description, and sometimes people initiate a case via a gigantic email, and all of that email thread would come through on the visualforce assignment email

so i just need to truncate the length of the description.

the original
<apex:outputField value="{!relatedTo.Description}"></apex:outputField>

tried inserting a left in there, could not get anything to save
examples
/apex:outputField

apex:outputText would lose the formatting, regardless of how I tried to work with it, like


/apex:outputText

I even tried abbreviating the string in a vf component, but outputText would lose the...

Continue reading →


Marking fields used in Integrations

Another way to mark fields used in Integrations.

2 years back I conjured up this approach to prevent deletion of fields used in integrations.

I still needed a better way to flag these fields. Description field is pretty good, but wanted to add the picklist value “Integrated” to the field usage picklist.

Turns out that you can only do this via the metadata api, so this is how to do it

  • create a file named package.xml with the following content
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>FieldBusinessStatus</members>
<name>StandardValueSet</name>
</types>
<version>54.0</version>
</Package>
  • login to workbench.developerforce.com and go to migration - retrieve
  • upload that package.xml file
  • click ‘download zip file’

this downloads the existing values for Field Usage picklist, in case someone has customized it before you!

  • Unzip the file
  • Edit the file...

Continue reading →