0

I have the following requirement:

I need 2 layouts, one when a user clicks on the standard New button on the Lead list page. Here the users sees all the fields and fills the neceeasary fields and saves. (Irrespective of user profile).

the second: when you go in to the detail page of the lead, again irrespective of user profile, I want to see a page which only shows some fields. Basically, the page is in split in to 2 parts, one with fields mandatory to display and other with optional fields which depending on user role can be hidden or shown.

I know that I can remove the fields in page layout, but when the user tries to create a record, he needs to see all the fields. For optional section, I made a lightning component and in the backend I decide who sees and who doesnt based on the current user role.

Now, for the mandatory section is creating another lightning component or creating a list button with custom visualforce page my only 2 options?

  • What do you mean by "but when the user tries to create a page layout, he needs to see all the fields"? – Hengky Ilawan Jun 6 at 0:22
  • I made a mistake. I meant record. I corrected it now. – nSv23 Jun 6 at 7:39
1

What you want to do can be achieved by using two Record Types, one page layout for each record type and a workflow.

  1. Assign a default page layout and put only the fields that you want to show on creation time.
  2. Create another page layout and assign it for the second record type.
  3. Create a workflow that only run upon creation of a lead record to change the record type to the second record type.

For "I decide who sees and who doesnt based on the current user role", you should rethink your approach because Role doesn't control who can see certain fields, they are controlled by Profile via Field Level Security.

| improve this answer | |
  • I will try it out and let you know. – nSv23 Jun 6 at 7:41
  • Unfortunately it has to be with roles. For example if a user with role r1 creates a lead only the users with r1, their "siblings" that's other roles with same parent as r1 and the parent role can see all the fields, other roles see only the mandatory fields, but they can have the same profile as r1, so I can't use field level security. – nSv23 Jun 6 at 7:47
  • You can restrict the FLS and use permission set to open up some optional fields to the users who need to access them. – Hengky Ilawan Jun 6 at 8:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.