King Koo Koolest Summer 20 Salesforce Features Part 7 - Dynamic Forms & Dynamic Actions
#summer20 #trailheart

King Koo Koolest Summer 20 Salesforce Features Part 7 - Dynamic Forms & Dynamic Actions

No alt text provided for this image

Disclaimer / Introduction

The topics I am covering today are Non-GA Preview which normally means the features are not available yet, and may take awhile before you can actually use it in your production environment.

Salesforce's own Salesforce Admins site already had an article about it when Dynamic Form and Dynamic Action were announced at Dreamforce 2019.

I'm sure by now you have seen this topic covered in many other blogs. This is such an interesting and exciting feature that nobody could resist. I on the other hand would like to be more cautious. Don't get me wrong! This is a HUGE DEAL!! My concern is simply that this feature may still be a year away from being GA, so what you get now in Summer 20 can be very different from what you will end up getting. Well, I spent a few hours exploring this feature yesterday and today, and I must admit, the more I investigate, the more things I find about this new Dynamic Form feature; it's like peeling an onion, pretty cool.

OK, enough disclaimer. Enough intro. Here we go.

Dynamic Forms (Non-GA Preview)

As Salesforce consultants, we sometimes treat page layouts as our worst enemies. The challenge is threefold. First, sometimes we have complex objects that may have many record types. I am on a project in which I may end up having 15 record types for this object. And because each record type requires slightly different data points, we may have one page layout for each record type (15 page layouts for these 15 record types). Then you may also want to expose the object to your community members except that you do not want them to see things like the owner of the record (if you are the owner of the record, you don't want your community members to hunt you down do you?), so you have an extra page layout for each record type, just to take out the Owner field. You end up with 30 page layouts for these 15 record types. If you now need to add a new data point that is common across all your record types, after you have created the field, someone needs to do the dirty job of moving the field to the right spot for each page layout, . Yikes.

The second challenge comes from your users. "Can you show the 'Please Explain' field only if the user selects 'Other' from the picklist?" is a very common type of questions that I hear from time to time. My robotic reply would be "Yes but it would require Lightning Component or Visualforce, so.. coding". The disappointment in their eyes is sometimes unbearable.

The third challenge is simply the fact that, when you are configuring your record detail page and need to update your page layouts, you have to jump through many hoops to get to the page layout edit page. Either you need go to Setup, Object Manager, find the object and then select the page layout sub-tab, or you edit the page, and then go to the page layout via the App Builder. It's just not straightforward.

Dynamic Forms will be your honey. They easily answer these three very common challenges. Let's take a look what happens after you have enabled Dynamic Forms (something you probably don't need to do in the future when all page layouts become dynamic).

No alt text provided for this image

I'm looking at one of my records that is an instance of a Construction Project object. It contains general typical information about construction projects, but also a field called "Building Permit Number" that only applies to commercial building projects, hence the record type "Commercial Building" and hence the "Commercial Building Specific Information" section on my page layout that is specific to this record type. To change my field layout, I click the "Edit Page" to go to the App Builder.

No alt text provided for this image

All cool features I found about Dynamic Forms

1. Field Section fields component, and Fields in App Builder

Two things to notice. Next to the Components tab you now have a Fields tab which shows you 1) a new lightning component within the App Builder called "Field Section", and 2) a list of all fields for the object. Also, if you click the Record Detail component, you now have an option to upgrade the page layout to a dynamic form. When you click the "Upgrade Now" button, a list of all page layouts for the object is displayed, and you will be asked to select one page layout that is used as the base for the dynamic form, together with some options. Go and experiment your options! If you find out you select the wrong page layout, or if you just want to reconsider your options, you can always choose the Undo button (purple hexagon in the above image).

No alt text provided for this image

When you upgrade, what's originally your "Record Detail" component is broken out into separate "Field Section" components based on the definition of the page layout you selected. After the dynamic form is generated, you will now see that my "Commercial Building Specific Information" section from my page layout is available as a component in my App Builder. This component is of type "Field Section", again, the same new lightning component that I mentioned that is now showing under this new "Fields" tab. If you have used App Builder, you know therefore it means you can create more field sections by dragging and dropping the "Field Section" component onto your page layout.

No alt text provided for this image

2. Component Visibility on Field Section fields component and Fields

Also, if you have used App Builder, you have seen this property called "Set Component Visibility", a feature to dynamically let you show or hide components. The same applies to this "Field Section" component! That means you can now use a filter to show this "Field Section" only if the record type for my Construction Project record is "Commercial Building". That's great news because you may now be able to reduce the number of page layouts using this component visibility.

Now, what about fields? Can we also show and hide fields dynamically? For example, if my Construction Project is still in Planning status, fields such as Estimated Start Date and Estimated End Date make sense, but Actual Start Date and Actual End Date will always be blank, so rather than showing blank values, it's better to not even show them so they don't clutter the screen.

No alt text provided for this image

Yes you can! As the image above illustrates, I am able to set the Actual End Date to only show if the Project Status is not Planning. And oh yeah, once you set the visibility condition, you will see the orange eye icon, just like any other components. So it is really helpful to see which fields or field sections that have established visibility conditions.

No alt text provided for this image

3. Draggable Field Section fields component and Fields

Also, when you hover the mouse over the field, you will realize the cursor changes from an arrow to a hand. That means you are able to drag the field anywhere on your page layout. By the way same goes for Field Sections. You can move the entire field section from one spot to another, and that carries along with it all the fields in the field section.

No alt text provided for this image

4. Multiple occurrences of same field on page layout

Oh, another thing about dynamic form. Let's take a look again at this new "Fields" tab and find out what's being displayed.

Under Fields Components you have a "Field Section" component, and as mentioned, you can drag and drop it onto your page layout to create more field sections. Fine, it's like any other lightning components in App Builder.

Under Fields though, you do not have a "Field" lightning component. Rather, each field in your object is listed. This is one difference in behaviour from other components within the App Builder. In other places within the App Builder, you drop a component onto a page to create a new instance of that component. For fields, you are not really creating a new field on the fly, you are really just adding or removing existing fields onto your page layout.

You may then wonder, if I can drag and drop Field Section components onto the page to create multiple field sections, can I drag and drop the Field onto the page multiple times too? Yes you can! This is something that you were not able to do with our old page layout (in fact, one of the two things that I find out that is new to page layouts - I'll come back to this later). You can really go silly if you want, such as my "Dynamic Form on Steroid" section below illustrates:

No alt text provided for this image

And Salesforce is very smart too, if I edit the form, and change my Project Status to another value and tab off, that change is propagated to all other occurrences of the same field:

No alt text provided for this image

Alright, this may look a little silly, but I think it can be very useful if, for example, you have a page layout with many fields; you can then show some important information at the top as well as at the bottom of the page layout.

5. Centralized field value for one-column field section

When you drop a field section into your page layout, you can indicate whether it is a one-column field section or a two-column field section, just like you can today.

No alt text provided for this image

To illustrate, see that my "Information" field section spans over one column, and my "Commercial Building Specific Information" section spans over two columns.

Why am I talking about? What is the significance? Earlier I said there are two new things to page layouts; adding the same field multiple times is one of them. Here is the second one - it's about how data is displayed for one-column field section.

No alt text provided for this image

Notice how the Project Name field, embedded in a one-column field section, is now displaying the field value centralized? The Building Permit Number that resides in a two-column field section displays as it normally does.

Dynamic Form Conclusion

Let's take a look at what I referred to as the three challenges about page layouts:

  1. Too many page layouts to handle different data points required for different record types.
  2. Not able to hide and show fields based on field values of other fields.
  3. Clumsy navigation to the page layout edit page.

It looks like to me that Dynamic Form has provided simple answers to all of them!

Dynamic Form does not replace page layouts

OK, I don't want you to think that Salesforce made any changes to my 30 page layouts. In fact, when I go back to the page layout configuration page for my Construction Project object, I found out that all my page layouts are still there, and none of them have been modified. Even though I made a lot of changes, all those changes are localized within my Construction Project lightning record page.

Do you remember I said earlier that, when you click the button to upgrade your page layout to dynamic form, Salesforce asks you for a page layout to use as the base for the dynamic form? What actually happens is that, Salesforce mocks up the dynamic form based on the page layout you selected, and then it removes Record Detail component (which hosts your page layout) off your page. If you want, you CAN drag the Record Detail component back to your lightning record page. If you do do that, App Builder will give you a warning that you are putting in duplicate components onto the page because you practically have your page layout showing up twice (through different components). But it does not actually prevent you from doing that.

As good as it sounds though.....

Now, does it answer everything under the sun? Currently, not. What are some of the problems or limitations that I found out about Dynamic Form?

First, it may come as a shock to you. As of now (Summer 20 release), this feature does not work with standard objects. None of them. Nah-ah, I don't think so. When they roll this feature into production, I hope they will at least enable this for our good friends such as Account and Contact.

Second, there are no empty sections. Remember on page layouts you can insert blank spaces to space fields out? As of Summer 20 anyway, you are not able to do that. When you upgrade to Dynamic Form, Salesforce asks you for a page layout that will be used as a base for the dynamic form. If you select a page layout that contains blank spaces, they are all collapsed in the dynamic form.

Third, when you upgrade to Dynamic Form, you are telling Salesforce you are forfeiting your page layouts. As I said, your Record Detail component is broken out into individual Field Section components. It's either all or nothing. That can be a challenge if you have many page layouts that you would like to converge. Going back to my 15 record type examples. Let's say, I haven't converted my Residential Building record type yet and for records of that record type I would like to show the original page layout and not the dynamic form. To achieve that, the clumsy process you need to do includes:

  • bring your "Record Detail" component back to your App Builder (just don't upgrade to dynamic form for that component) and set the component visibility to only show that for Residential Building record type,
  • for each "Field Section" component you have on the screen (you may have a lot), you have to set the component visibility to hide for Residential Building record type.

Fortunately at least you are able to do that, and when I test, the performance isn't bad!

Finally, as of now anyway, you don't have a way to control the tab-key order. It is always Top-Down. Which is very weird, for objects that you have not upgraded to Dynamic Form, the tab-key order is always Left-Right. That is very inconsistent behaviour between regular page layouts and dynamic forms. (As an aside, the tab-key order was respected in Classic, but it seems Lightning Experience never looks at how it was set up in page layout; the movement of tab keys is always left to right.)

The above are a few that I am finding problems with the Dynamic Form. But you never know, when the feature becomes GA, they may all be resolved.

Dynamic Actions (Beta)

Finally, Dynamic Actions. I decided to keep this section short because if you have come this far in my article, you probably guess what Dynamic Actions are about. Those are the "Edit", "Clone", "Delete" buttons that you see at the top right of the page, and now they can be configured individually.

Dynamic Actions are in Beta right now, while Dynamic Forms are in non-GA preview, but my guess is that both Dynamic Forms and Dynamic Actions will become GA at the same time. Will see.

No alt text provided for this image

To enable Dynamic Actions, you go to App Builder, and select the Highlights Panel component, and check the "Enable Dynamic Actions" checkbox.

As you see in the example, I have added "Start the Project" action which will only display if the Project Status = Planning. Other than that, my Edit, Delete and Clone actions always display.

My "Start the Project" action will display a modal window for me to update the status of the project, and it is defaulted to "Active". If I accept the change, then the "Start the Project" action should hide itself because the Project Status is no longer Planning.

No alt text provided for this image

What about the reverse? I tried to change the status from Active back to Planning, and sure enough, the Dynamic Action now shows up.

No alt text provided for this image

It is straightforward like that.

This is it! I hope you find this review interesting and useful. Let me know what you think!

This is probably my last feature article on Summer 20. I encourage you to check out the Release Notes, where you will find all the information you need to understand what other features are coming.

If you are interested, here is a list of other topics I have covered for Summer 20 release.

Enjoy summer, and stay safe and stay sane!!


Anna Thai

Salesforce Nerd | Automating business processes so you can focus on the things you're good at

4 年

Woohoo! Super excited for these!

Gidi Abramovich

Salesforce Solutions Architect

4 年

Great article, King Koo, I'm really looking forward for these features!!!

要查看或添加评论,请登录

Yue King Koo 古于璟的更多文章

社区洞察

其他会员也浏览了