0

There is a standard field Sales Price ( API: UnitPrice ) on the Contract Line Item Object. It seems like that field cannot be removed from Page Layouts - the following error is shown if we try to do so:

This field must be displayed on the page layout and cannot be removed.

We are storing some sensitive information on this field, which must not shown to a subset of users having a specific profile. I have already checked that the Field Level Security cannot reconfigured to keep this field hidden for the profile.

Can you help in suggesting some approach to achieve this? One more point, we cannot migrate the data from this field to some new custom field and use that instead, due to some business constraints.

Thanks.

1 Answer 1

1

Normally, the visibility of a field can be controlled from Object level permissions, Field level security, page layouts and, in some case, by encrypting them (so it would visible to only those assigned with View encrypted data permission). However, there are some standard fields that are marked as required by Salesforce themselves and none of the above mentioned options can be used to control their visibility. Such fields are identified via a blue dot in the page layout (edit mode). Your requirement was posted as an idea 12 years ago, but was not been prioritized over other features like dynamic pages. Consider upvoting this idea.

If you can TURN OFF Salesforce classic for the entire org or for the sub-set of users (ref: Turn Off Salesforce Classic for Your Org & Make Lightning Experience the Only Experience for Some Users), then you should be able to do the following:

  • Create a default lightning record page.

  • Upgrade it to dynamic forms and break up the record details page.

  • Set field section or field visibility for UnitPrice field based on user permission or profile. (Note that you may need to create a clone of the existing profile, assign it to the sub-set of the users and use this new profile to define the visibility condition.)

    Detailed documentation on the dynamic forms and step wise guidance to implement it can be found here & here.


Update: As pointed out by @DaveSmith, dynamic forms is not applicable on standard objects at the moment. However, it will most likely become GA with Spring '21 release (Feb '21).


The above mentioned approach doesn't work with classic page layouts, so it will not work if the user is able to switch to salesforce classic. If you can't TURN OFF Salesforce classic for the entire org or for the sub-set of users, then approaches to try out are mentioned below. I've not actually tried out these options and there will be quite a few limitations associated with these approaches, so I'll leave it to you for further exploration.

  • Custom record detail using Visual force and try to hide/ mask the field.
  • Encrypt the field using apex Crypto class, so that it will can be masked for specific users [AFAIK, UnitPrice field isn't one of the standard fields that can be encrypted OOB].
3
  • 1
    I don't think dynamic forms are supported for standard objects yet. Maybe I will go with the visualforce route and see if it is okay with business.
    – Dave Smith
    Dec 11, 2020 at 4:22
  • You are right. I totally missed out to mention that it my answer. As mentioned here, the support for dynamic forms in standard object is in Salesforce roadmap. Also, I noticed a comment from one of the members in Dynamic Forms & Actions Community group stating that dynamic forms is available for contract object in their pre-release spring 21 org. So, I guess this might become GA for standard objects by Feb '21.
    – arut
    Dec 11, 2020 at 6:46
  • Consider joining the community group to keep yourself updated on the relevant release updates.
    – arut
    Dec 11, 2020 at 6:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .