Skip to main content

a)      Create custom label named Save Project  and value ad TRUE

b)      Override new action on  project record : use lightning-record-form component so that new project should be saved only by reading custom label value using apex.  If Custom label value is true allow Project record to save , if not don’t allow. 

c)       Remove standard edit button and create new detailed button named as Edit.Custom edit action  on project record , use lightning-record-edit-form and only description field is editable. Also show up the project members  in a table(readonly).

 

This is /my Obj Details ?

Object Name : Project

Standard fields :

Project Id (Name): Text(30)

Custom fields :

Project Name : Text (100)

Description : TextArea

DueDate : Date 

Remaining Days for DueDate : Formula 

Status : Picklist(Initialized , Confirmed)  and set default value as Initialized.

Archived : Checkbox 

 

#LWC  #LWCOpenSource  #Trailhead

2 respuestas
  1. 31 oct 2021, 9:00

    Hi @Rahul Palav, for the scenarios you can follow along

     

    a) Follow these steps to create a custom label 1. Go to Setup and type custom label in Quick Find.

    Hi , for the scenarios you can follow along a) Follow these steps to create a custom label 1. Go to Setup and type custom label in Quick Find. 2.

     2. Click on "New custom label" and fill in your label details.

    custom-labels-2.png

     

    b) Follow these steps for scenario (b)

     

    Step 1 - Create a Lightning Web Component with a lightning-record-form component where you can implement view and with help of the Apex Class (Controller class for LWC) implement the business logic.

     

    Step 2 - To Open this Lightning Component with the new Action on the Project Record, you first have to create an Aura Component and add the following tags inside the aura component (.cmp)

     

    <aura:component implements="force:lightningQuickAction,force:hasRecordId">     <c:customAction /> </aura:component>

     

    Here in the place of custom action type in the name of your LWC component in Aura Format. It means if in LWC you write the following tag

     

    <c-my-component> </c-my-component>  then in Aura, you should write it as   <c:myComponent />

     

    Now you need to edit the 'New' button functionality and for that follow these steps.  1. Click on the setup and Go to Object Manager. 2. Select your object (Project in your case). 3. Click on the Buttons, Links, and Actions.

     

    buttons-links-and-actions.png

     4. Scroll Down till you get the 'New' button Action, Click on edit.

     

    new-button.png

     5. From Lightning Component Override option select Lightning Component.

     

    lightning-experience-override.png

     6. From the picklist choose your aura component. 7. Click on Save.

    and it's done.

     

    c) Instead of Deleting the Edit button (Which is not even possible as it is a standard button) you can use the same approach as in the previous step. edit-button.png

     Definitely, you have to create new LWC and Aura Components for the edit option as well.

     

    [Note - Creating Aura components is a must as right now there is no way in Salesforce to override Lightning Experience action with an LWC]

     

    Hope this will help you in your scenarios. In case of any other issues please let me know.

     

    Please mark it as the best answer in case it resolves your blocker.

     

    Thanks.

0/9000