Wednesday, January 10, 2018

Checking for a changed value on a New Record

When using the Process Builder the conditions for a Changed value will not always be met for a new record.   That is to say that when you add a record, even though the fields all have new values, they will not fire an is changed condition.  This means that you also have to trigger the Process Builder on an ISNew criteria.   But at this time, Process Builder does not allow you to check if the record is new without dropping to a formula. 

So instead of doing something like this:


You have to do convert to a formula and do something like this:

Tuesday, January 9, 2018

Deleting a Salesforce Case with Tasks attached

When you are trying to delete a Case in Salesforce that has tasks attached, it sometimes will not allow you to delete the Case because the user doesn't have delete permissions on the task. When Salesforce deletes the Case, it attempts to delete all of the Tasks, it does not just disconnect the Tasks and leave them.

Currently (Winter 18 Release), there is no 'Task' permission that will fix this. The solution is that the user must take ownership of the Case. Once the user has ownership of the case they can delete the case and all of its tasks with it.

Wednesday, January 3, 2018

Compare Field-Level Permissions Between Profiles

If you want to compare field level permissions between two profiles, and you can use something like dbAmp to download your data to a SQL database, you can run a query like the following to compare two profiles.

select P1Perms.SobjectType, P1Perms.Field, P1Perms.PermissionsRead, P2Perms.PermissionsRead, P1Perms.PermissionsEdit, P2Perms.PermissionsEdit from 
(select fp.field, SobjectType, fp.PermissionsEdit, fp.PermissionsRead, profile.name from fieldpermissions fp
 join permissionset as ps on ps.id = fp.ParentId
 join profile on profile.Id = ps.ProfileId
 where profile.name = 'System Administrator (Custom)'
) as P1Perms 
left join (select fp.field, SobjectType, fp.PermissionsEdit, fp.PermissionsRead, profile.name from fieldpermissions fp
 join permissionset as ps on ps.id = fp.ParentId
 join profile on profile.Id = ps.ProfileId
 where profile.name = 'Business Development'
) as P2Perms on P1Perms.Field = P2Perms.Field and P1Perms.SobjectType = P2Perms.SobjectType
  where P1Perms.PermissionsRead <> P2Perms.PermissionsRead or P1Perms.PermissionsEdit <> P2Perms.PermissionsEdit or P2Perms.PermissionsRead is null
order by P1Perms.SobjectType, P1Perms.Field