Pages

Showing posts with label User. Show all posts
Showing posts with label User. Show all posts

Tuesday, May 13, 2025

Salesforce: Inactive User

When a Salesforce user has been deactivated, can we still assign the user as the record owner, or populate the user into a lookup field? 

1. Lookup Fields

From the Page Layout (UI): In the standard Salesforce user interface, you typically cannot select or populate a lookup field with an inactive user. The UI filters out inactive users from lookup fields to prevent confusion and ensure that only active users are selectable. Therefore, if you are trying to populate a lookup field from the page layout, you will not see inactive users listed.

From the Backend: You can populate lookup fields with inactive users through backend processes. This includes using data import tools, APIs, or automated processes (like Apex code, workflows, or triggers).


2. Record Ownership

From Setup > User Interface > User Interface, look for "Set Audit Fields upon Record Creation" and "Update Records with Inactive Owners" and enable it. Then, create a permission set with "Update Records with Inactive Owners" permission or enable the permission in the profile.

From the Page Layout (UI): In the standard Salesforce user interface, you typically cannot find or populate the record owner with an inactive user, even if you already have the above permission granted.

From the Backend: If you have "Update Records with Inactive Owners" permission enabled, you can populate record ownership with an inactive user through backend processes. This includes using data import tools, APIs, or automated processes (like Apex code, workflows, or triggers).

Without the permission enabled, you will receive the error message INACTIVE_OWNER_OR_USER:



Sunday, January 23, 2022

Salesforce: Mass Update Role Hierarchy Access

In a blog written many years back, I shared sharing access from role hierarchy, which is about to give access to the Account owner for the Contact/Opportunity/Case records that related to the Account, but is not owned by Account Owner.


That access information is stored in the UserRole object, and you can mass update the access by simply updating the records in the UserRole object.

A sample query
SELECT Id, Name, ParentRoleId, DeveloperName, RollupDescription, ContactAccessForAccountOwner, OpportunityAccessForAccountOwner, CaseAccessForAccountOwner FROM UserRole WHERE PortalType = 'None'

A few fields are worth knowing from the above query:

- PortalType = None: Salesforce application role, CustomerPortal: Customer portal role, Partner: partner portal role.

- RollupDescription, this is "Role Name as displayed on reports", so it can be different with the actual Role Name.


Reference:




Wednesday, April 4, 2018

Salesforce: Change User Email Address

Whether you’re a Salesforce user or Salesforce admin, you can change the email address in the details on User records to update contact information.

Requirement: Email addresses can only be updated for Users listed as “Active” on the User Detail page.

Once email change in the setup menu, a notification email will be sent to the original email address and a verification email will be sent to the new email address to authorize the change. To apply the update, the user must click the verification link sent to their new email and complete the resulting verification steps within 72 hours.

Please note that this will happen when changing the email address on the user record, including changing the "return address" from the user's personal email settings.



Expected Behavior:
When these fields are updated, you can expect the following:
  • Username: the field is updated and the user receives an email notification, notifying them of the change.
  • Email Address: an email is sent to the new email address so that the change can be confirmed. The field is not updated until the email address owner confirms the change. An email is also sent to the older email address informing the change.
  • Return Email Address: an email is sent to the new email address so that the change can be confirmed. The field is not updated until the email address owner confirms the change.


Reference:

Page-level ad