anusha(salesforce developer)

Friday, 24 June 2016

Show value only to Owner and Manager?

Use case:
A scoring system has been implemented to auto calculate if a lead is valid to pursue. But, the score should only visible to the record owner manager.

In Salesforce, we only can set field visibility using Field Level Security (FLS) which is based on Profile. But record owner manager have the same profile with the record owner, and the manager may owned a lead which he supposed not able to see the score, only the manager's manager able to see it.

Solution:
1. Set the score field not visible from all Profile with FLS
2. Create a formula field and make it visible to all Profile
IF( $User.Id = Owner.ManagerId, Score__c, null)

For other scenario, if only the owner and owner's manager should be able to see the score, use this formula:
IF( $User.Id = OwnerId || $User.Id = Owner.ManagerId, Score__c, null)

No comments:

Post a Comment