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?

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

2 Answers 2

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.

3
  • I will try it out and let you know.
    – nSv23
    Commented Jun 6, 2020 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
    Commented Jun 6, 2020 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. Commented Jun 6, 2020 at 8:02
0

Can you try like this: Create advanced Record page (you can drag and drop fields) and In the each field section you add the following filter criterias.

  1. For Section need to be shown in Creation layout: Record -> Created By -> UserName Equal blank
  2. For Section need to be shown in Edit layout: Record -> Created By -> UserName Not Equal blank

You must log in to answer this question.

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