Posts

Showing posts with the label User

Salesforce Fact #947 | Resolving dashboard logged-in user limit error

As we know there's a limit on the number of dashboards with the option to run as the logged-in user, the below queries are useful while troubleshooting and resolving the error: SELECT FolderName,Title FROM Dashboard WHERE Type = 'LoggedInUser' OR Type = 'MyTeamUser' -> This will fetch the list if dynamic dashboards present in the org SELECT Id,Title FROM Dashboard WHERE Type != 'SpecifiedUser' -> This will return dynamic dashboards that are not in private folders.  SELECT Id,Title FROM Dashboard USING SCOPE allPrivate WHERE Type != 'SpecifiedUser'  -> This will return dynamic dashboards that are in private folders. Reference:  https://help.salesforce.com/s/articleView?id=000385369&type=1

Salesforce Fact #894 | Adding user to multiple public groups/queues at once

Image
There are times when we need to add a particular user to multiple public groups and queues. Now, based on the OOTB option, we can do that by going to each and every public group or queue. We can create a screen flow as well to assign a particular user to multiple public group or queue at once to ease the work for users. Attached are the screenshots.

Salesforce Fact #881 | Community user check using ContactId on User

Image
We can make use of ContactId field in User object to identify if the current logged in user is a community user or not. The same can be used in LWC. Attached is the screenshot. Note: The ContactId field cannot be updated manually and while trying to do so, the below error is encountered: 'You can't create a contact for this user because the org doesn't have the necessary permissions. Contact Salesforce Customer Support for help.'

Salesforce Fact 880 | Impact on query using user fullname due to user locale change

Locale changes affect the name format of the user. For some of the locales, the Lastname appears followed by Firstname when full name is displayed. So, if we have any logic where we are fetching data based on the Fullname field on User object, we need to be careful.  For example, if the user's full name is 'Tom Stewart' where Firstname is 'Tom' and Lastname is 'Stewart', in case of Hungarian(Hungary) locale this is interpreted as 'Stewart Tom'. So, either we should use any other field like username or we should use any other filter to fetch the required data.

Salesforce Fact #740 | External user self-deactivation

There is a settings in User Management Settings which allows the external users to deactivate their own accounts. Reference:  https://help.salesforce.com/s/articleView?id=sf.users_deactivate_external_option.htm&type=5

Salesforce Fact #703 | POC on adding a user to multiple territories using screen flow

Image
UserTerritory2Association object keeps track of the user assignment to the territories. Let's have an automation leveraging screen flow to let admins add a user to multiple territories in a single go. In this example, we have created a screen flow which takes the userid input and also allows the user to select multiple territories(in this case, it is max 5). Then, we are checking whether the user is already part of the territory, if not we are creating UserTerritory2Association records which eventually adds the user to the selected territories. Note: Since Territory2 object is not supported in UI API, we get an error on selecting the territory but it can be ignored. Attached are the screenshots.

Salesforce Fact #693 | User access policy in action

Image
User Access Policies is now in Beta phase. Thanks to Summer'23 release. Now, you can automate the Permission Set, Public Group or queue assignments once you create or update the any user which matches a particular Profile/Role/Permission Set condition. In this example, we have setup a User access policy which assigns the PS 'Test Permission Set' and Public group 'Test PG1' if the user with profile 'Test Profile' is created/updated. Note: There are couple of statuses available while configuring User access policy. It gets executed only if it is in 'Active' status.  In order to enable the feature, go to User Management Settings -> Enable 'User Access Policies (Beta)'. Attached are the screenshots.

Salesforce Fact #682 | IsPortalEnabled

How to check whether a user is a community user in code. There is a boolean field on User object named 'IsPortalEnabled' which indicates whether an active, external user has access to experience sites or portals. This field can be accessed in flows and triggers to check the user context. Reference:  https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_user.htm

Salesforce Fact #650 | PersonalInfo_EPIM fieldset

There is a fieldset named 'PersonalInfo_EPIM' in User object which secures personal information from guest and community users. By default, the fieldset contains 30 user fields and can be updated as well to include other fields. Reference:  https://help.salesforce.com/s/articleView?id=release-notes.rn_experiences_secure_personal_info_fields_with_field_sets.htm&release=236&type=5

Salesforce Fact #548 | Permset assignment to inactive user

If we try to assign any permission set to any inactive user by mistake, we get the below error: INACTIVE_OWNER_OR_USER, owner or user is inactive. Org Id:<orgid> However, we can remove permission sets from inactive users.

Salesforce Fact #544 | IsProfilePhotoActive

How to check whether the profile photo is set for the user. There is a field named ' IsProfilePhotoActive ' in User object which is true when the profile photo is set, else it is false. Reference: https://developer.salesforce.com/docs/atlas.en-us.238.0.object_reference.meta/object_reference/sforce_api_objects_user.htm