Flow Name: [Before Save] Populate Profile Name On User Create/Update¶
Last Updated: 2025-08-18 Source Code: Before_Save_Populate_Profile_Name_On_User_Create_Update.flow-meta.xml
API Name: Before_Save_Populate_Profile_Name_On_User_Create_Update Status: Active Type: Custom Trigger: Before Save - User Record Create/Update when ProfileId changes
Business Purpose¶
This flow automatically maintains data consistency by populating a custom ProfileName__c field on User records whenever the ProfileId changes during user creation or updates. This ensures profile name information is readily available without requiring additional lookups.
Process Flow¶
- Trigger: Flow executes when a User record is created or updated AND the ProfileId field has changed
- Profile Lookup: Query the Profile object using the User's ProfileId to retrieve profile details
- Record Found Check: Verify if a matching Profile record was found
- Profile Name Update: If profile found, populate the ProfileName__c custom field with the profile's Name
- Process Complete: User record is saved with updated profile name information
📊 Click to view Process Flow Diagram
flowchart TD
Start([Start: User Create/Update<br/>Before Save Trigger]) --> ProfileChanged{ProfileId<br/>Changed?}
ProfileChanged -->|No| End([End])
ProfileChanged -->|Yes| GetProfile[Get Profile Record<br/>using ProfileId]
GetProfile --> Found{Profile<br/>Found?}
Found -->|No| End
Found -->|Yes| Update[Set ProfileName__c<br/>= Profile.Name]
Update --> End
style Start fill:#e1f5ff
style ProfileChanged fill:#fff4e1
style GetProfile fill:#f0e1ff
style Found fill:#fff4e1
style Update fill:#ffe1e1
style End fill:#e1f5ff
Key Business Rules¶
- Only executes when ProfileId field is changed (not on every User save)
- Requires existing Profile record to update the ProfileName__c field
- Updates occur before the User record is saved (before-save trigger)
- Custom field ProfileName__c must exist on User object
Dependencies¶
- User object with custom field ProfileName__c
- Profile object (standard Salesforce object)
- User.ProfileId field relationship to Profile.Id
Changes¶
No specific pull request or change notes documented in the flow metadata.
⚠️ Pre-Go-Live Concerns¶
CRITICAL - Fix Before Go-Live¶
- Missing Error Handling: No fault paths or error handling if Profile lookup fails or returns unexpected results
- Missing Null Check: No validation that ProfileName__c field exists or is accessible before assignment
HIGH - Address Soon After Go-Live¶
- Performance Impact: Every ProfileId change triggers a SOQL query which could impact performance with bulk operations
- Limited Fault Tolerance: Flow will fail silently if Profile record is deleted but User still references it
MEDIUM - Future Enhancement¶
- Hardcoded Field Reference: ProfileName__c field is hardcoded - consider making this configurable
- No Audit Trail: No logging of when/why profile name changes occur
LOW - Monitor¶
- Edge Case Handling: Behavior with inactive or locked profiles not explicitly defined
- Bulk Operation Scaling: Monitor performance during large user imports or mass profile changes
Maintenance Notes¶
This is a relatively simple flow with low complexity. However, it operates on the critical User object and should be reviewed whenever:
- User object custom fields are modified
- Profile management processes change
- Bulk user operations are planned
- Performance issues are reported with user saves
Recommended Review Schedule: Quarterly or before major user management system changes