Posts

Showing posts with the label Salesforce

Get the URL Root in a Formula

If you are creating links in a formula, you want them to work in sandboxes. If you have a URL like: https://myOrg--sbox.sandbox.my.salesforce.com If you use: "https://" & mid($Api.Enterprise_Server_URL_500,9,(FIND("/",$Api.Enterprise_Server_URL_500 ,9)-8)) You will get: https://myorg--sbox.sandbox.my.salesforce.com/ Or, for Communities, "https://" & mid($Api.Enterprise_Server_URL_500,9,(FIND("/",$Api.Enterprise_Server_URL_500 ,9)-8)-15)&"site.com"   Note: For Communities if you have a custom domain you should first check for whether you are in production, because your custom URL won't fit the pattern. This works by: Start with the literal string "https://" Find the mid substring where: The URL is the Enterprise Server URL Starting at location 9 (after https://) For length  Using FIND Find the first slash after location 9 subtracting 8 characters for https:// In the Community version, we pull out the "sale...

Simpler, Cleaner Queueables

I've just uploaded the next generation of my Salesforce Queueable infrastructure. This uses an abstract class to create a very simple, powerful way of invoking Queueables.  Just create a class that extends "MyQueueable" and create few quick override classes, then implement your business logic.  GitHub - See primarily /src/classes/ MyQueueable and /src/classes/ AccountTriggerHandlerQueueable Wiki- How to Use It Happy asynchronousing.  

What Happens To "Inflight" Process Builders When You Activate a new Version?

Image
tl;dr : If an individual record is in a "Paused Flow Interview" state, and you create a new version of the Process Builder, the record will "wake up" at its specified time and complete the actions as specified in the version of the PB that was active when the record entered the paused state. There is some confusion as to what happens to Process Builders that have "inflight" time-based actions when you create a new version of the PB.  The information from Salesforce is incomplete and there are contradictory StackExchange answers, including here. At the time of writing, the first answer answers the wrong question, and the 2nd and 3rd answers fully contradict each other. Clearly this is due for someone to just test it. My Test I conducted the following test - I'm going to create a PB, create a test record, and see what happens if I update the PB while the record is pending. One of three things is going to happen: Nothing will happen to the record The re...

Salesforce: Check if Record Has Been Manually Edited

We recently had a requirement in Salesforce that was a little unique. An ongoing automated process would update the associated Contact to a record, however they didn’t want the automated process to do the update if the field had been updated by a human. Makes sense – if someone takes the time to make a manual association of a Contact to a record, then it’s probably better information than the automatic matching algorithm. As far as I can tell it’s impossible at runtime to know if the edit is due to a UI edit or is coming from code, so that’s out. Here’s how we made it happen. The idea is to have a “last updated by code” checkbox that will be set by a workflow. But in order for it to know if it’s been updated by code, you need a 2nd checkbox that is only updated in Apex. First, make two checkboxes on your record: Contact_Change_Trailing_Lock__c Contact_Last_Changed_By_Code__c Set the latter to true by default when a new record is crea...

Salesforce: Who Has Permission? (And what Profiles/Permission SetsGrant It?)

“Can you run me a report to see who has edit permissions on Cases?” It’s the kind of thing that makes you cringe since it’s such a simple question and not remotely easy to achieve since the config screens are a disaster and it could be in any number of Profiles or Permission Sets. Here’s how to find out. The following query will give you a quick list. (H/T Adam Torman ) [code lang=”sql”] SELECT Assignee.Name FROM PermissionSetAssignment WHERE PermissionSetId IN (SELECT ParentId FROM ObjectPermissions WHERE SObjectType = ‘My_Object__c’ AND (PermissionsCreate = true OR PermissionsEdit = true)) and Assignee.isActive = true [/code] You can run this in the Developer Console under “Query Editor” tab. Note that you have to change “My_Object__c” to your object name, and this filters by active users and Create or Edit permissions. You can run this using Workbench , dump it to Excel and deduplicate it. Problem solved. Great. So What Profiles/Permission Sets Grant Access? So the next ques...

Salesforce vs Dynamics CRM: Security Model

Image
To follow up on my popular  Dynamics vs Salesforce: The War From the Trenches , I thought I’d dig a bit deeper into the security models. The models are considerably different and have their own strengths and weaknesses. When deciding between Salesforce and Microsoft, the security model is perhaps the most important difference. When implementing CRM, who can see what is an enormous time suck and causes a lot of trouble. It’s the bad side of the 80-20 rule – this is the thing that’s 20% of your project but will consume 80% of your time. Dynamics – Simple & Consistent, But Susceptible to Exceptions In Dynamics, you have user roles, and hierarchy governed by something called Business Units. This means you can implement a clean org-chart security model very easily. The East Region VP sees everything in the New York and Atlanta branches, but nothing in San Francisco. And Johnny Sales Rep in New York can see only his own stuff but not the guy in the next cube...

Dynamics CRM vs Salesforce: Part II

To follow up on my popular 1st blog Dynamics vs Salesforce: The War From the Trenches, here are some additional differences. Field Auditing : SFDC only tracks change history on 20 fields per object/entity and keeps history for six months – if you want to keep history perpetually, you have to download them manually twice a year. Or, you can buy Salesforce Shield for an additional fee, which audits more fields and activities like exports. Microsoft audits all fields and keeps it as long as you want but does not audit activities that are not field changes, like export activity. Configuration Auditing : SFDC tracks the history of configuration changes – who made a field and when, etc. Microsoft does not track this at all. Products and Price Lists : Microsoft really shines relative to Salesforce here with CRM 2015+. Rather than enter a product line by line, screen by screen, there is a rapid-entry tool (but it’s not customizable). Microsoft also has advanced kits/bundling,...

Dynamics vs Salesforce: The War From the Trenches

Image
I’ve been pretty deep in Salesforce.com (SFDC) the last few weeks. There are a lot of articles out there that compare the two solutions at a CIO level, so I thought I’d take a moment to outline some of the more nitty-gritty pros and cons. Here are some of the key differences in my mind. Where Salesforce Wins VisualForce makes for a much more customizable interface . You’re not limited to dropping fields on a form – you can make a custom webpage part of your process. Custom buttons too. So what you see on the screen is not limited to drag and drop fields. Salesforce’s implementation of Apex unit testing is outstanding. You can create test classes and you  must run them before you can promote code into an instance. It’s brilliant and makes you a lot more confident deploying code. Salesforce has a lot of native functionality  that Microsoft still hasn’t gotten to. Lead assignment rules, approval processes, autonumbering, rich text text areas, dep...