Skip to main content Join us at TDX in San Francisco or on Salesforce+ on March 5-6 for the Developer Conference for the AI Agent Era. Register now.

#LWC Component1 discussing

Hi All,

I want to learn the LWC in Salesforce.

Could anyone please provide the roadmap that I need to follow.

If possible could please share the resources as well

Thanks in advance 😇

#Salesforce Developer #LWC #LWC Component #LWC Development #LWC Components
11 answers
  1. Oct 25, 2024, 9:57 AM

    I can share you my udemy credentials..

    you can learn lwc from there as well or from the resources above provided

0/9000

Hi,

I am trying to reload the previous page after saving an edit form. After clicking on Save, I have used  window.history.back(); but it only navigates to the previous page, I require it to reload as well. Is there a way to do this?

#LWC  #LWC Component #Custom LWC #LWC Development #LWC Components

4 answers
  1. Dec 10, 2024, 7:23 AM

    Hii,

    To navigate back and reload the previous page, the most straightforward solution is to use window.history.back() followed by a short delay and window.location.reload().

     

    The implementation may look something like this : 

    window.history.back();

    setTimeout(function() {

    window.location.reload();

    }, 500);

0/9000

//I have created checkboxes using checkgroup the checkboxes are in single line iam trying to align in two columns but iam not succeded.  

<lightning-checkbox-group name="Checkbox Group" label="Checkbox Group" options={options}                         value={value} onchange={handleChange}></lightning-checkbox-group>                     <p>Selected Values are: {selectedValues}</p>

 

Thanks for any Help

 

#Trailhead #LWC #LWC Development #LWC Component #Lightning #Lightning Web Components

2 answers
  1. Nov 18, 2024, 3:01 PM

    To display checkboxes in two columns using lightning-checkbox-group, you'll need to adjust the layout using CSS because lightning-checkbox-group doesn't natively support multi-column layouts out of the box.

     

    You can achieve the two-column layout by wrapping the checkboxes in a custom div container and using CSS Grid or Flexbox to display the checkboxes in two columns.

     

    You can use something like this : 

    /* Styling for the checkbox container to use grid */

    .checkbox-container {

     display: grid; /* Use grid layout */

     grid-template-columns: repeat(2, 1fr); /* Create two equal columns */

     gap: 16px; /* Add space between checkboxes */

     max-width: 600px; /* Optional: set a max width */

    }

     

    /* Ensure the checkbox options fit well inside each column */

    .lightning-checkbox-group .slds-checkbox_faux {

     margin-bottom: 8px; /* Adjust the spacing between checkboxes */

    }

0/9000

Hi all

I have written LWC that adds a new row whenever I click on the plus button but the newly added row inherits the value from the previous row. I want to set the values for the newly created rows as optional. Can anyone please help me here?

 

New Row inherits the value of previous row

 

#LWC Component  #LWC Development  #LWC

3 answers
  1. Oct 10, 2024, 8:26 AM

    Hii,

    If you want to ensure that newly added rows do not inherit values from the previous row, you should make sure that the data structure you use to hold the rows is initialized with completely new values each time(ideally blank here).

    You can use row add approach something like this 

     

    // The new row that you create, make its value empty

    const newRow = { id: rowId++, field1: '', field2: '' }

    OR 

    if you are fetching existing value, make sure to make it empty before adding the row.

     

    With this implementation, clicking the "Add Row" button will create a new row with empty fields, preventing any inheritance of values from previous rows. This way, all fields in newly created rows remain optional until filled by the user.

    If this does not work, please share exact context with more information.

     

    Please mark this as best answer if it solved your query.

0/9000

I have created an LWC that takes the recordId from the URL.

https://myurl.lightning.force.com/lightning/n/invoice?c__recordId=a0B1q00000Jy2ZeEAJ

 

Now I have added the LWC in the aura component and added the aura component in a Visualforce page. Then I made the Visualforce page public by creating a new Force.com Site.

 

My new URL is https://myurl.force.com/invoice

I have tried

https://myurl.force.com/invoice?Id=a0B1q00000Jy2ZeEAJ

https://myurl.force.com/invoice?recordId=a0B1q00000Jy2ZeEAJ

https://myurl.force.com/invoice?c__recordId=a0B1q00000Jy2ZeEAJ

 

But I am not getting the parameter from the URL to my LWC.  How to solve this problem? 

 

PublicInvoice.app

<aura:application extends="ltng:outApp" implements="ltng:allowGuestAccess" access="Global">

<aura:dependency resource="c:molliePayment"/>

</aura:application>

 

PublicPayment.page

<apex:page standardController="Verkoopfactuur__c" lightningStylesheets="true">

<apex:includeLightning />

<div id="LightningAppDivId"></div>

<script>

$Lightning.use("c:PublicInvoice", function() {

$Lightning.createComponent("c:molliePayment", {

recordId : "{!$CurrentPage.parameters.Id}"

},

"LightningAppDivId",

function(component) {

});

});

</script>

</apex:page>

 

#Sales Cloud #Salesforce Developer  #LWC Component

2 answers
0/9000

Hi Team,

 

I am working on Use Lightning Data Service to Work with Data

 

url: https://trailhead.salesforce.com/content/learn/modules/lightning-web-components-and-salesforce-data/use-lightning-data-service-to-work-with-data

 

I am creating the accountCreator Object following the same steps as mentioned in the post but once the component is deployed and page is created, fields are not displaying in the app page

 

Can someone help me on this

 

#Trailhead Challenges  #LWC Component

5 comments
  1. Aug 27, 2024, 1:17 PM

    @Sushma Vallambotla, I assume that this issue needs further review and we may need access to your Salesforce org where you are trying to complete the challenge. We will create a case on behalf of you for this issue and reach out to you via email to investigate further.

     

    Thank you!

     

    ++CreateTrailheadCase ← You can ignore this command, it is a tool used by our Agents to tell the system to create your case.

0/9000

Important Update: Changes to our Local Development Server deprecation plans

 

Remember when we mentioned plans to deprecate certain commands by mid-April? Well, after thorough testing, we’ve decided to keep them in action because they’re functioning just as they should!

However, we want to give you a heads-up on a few things to consider when using these commands. Specifically, if your Lightning Web Components include lwc:if, lwc:elseif, or lwc:else directives, you might encounter issues with the preview command. Why? Because our dev server doesn’t quite sync up with them yet.

While we won’t be issuing any fixes for this, we’ve got a brand-new solution in the pipeline slated for next year! So, stay tuned for that.

In the meantime, keep utilizing those commands and stay tuned for more updates. We’re committed to keeping you in the loop every step of the way.

1 comment
0/9000

Is there any option rather than LMS and Pub-Sub to communication between two unrelated LWC components. I got this Que. inside my interview and interviewer said there is one new option release from salesforce to communicate between unrelated component.

  #LWC Development #LWC Component

0/9000

I have a set of small packages using some shared LWC headless components (Javascript-only). I cannot find the right syntax to get my parent LWC component in package A to refer to child component in package B : it will not compile and not deploy to my scratch org, although package B is installed.

 

Questions :

  1. I have found no way of declaring child LWC as "public" in package B; I suppose all is public since the package is unlocked.
  2. I have found nothing about how to adapt jsconfig.json in package A to refer to child in package B
  3. Is it possible to share LWC components between (unlocked) packages ? If so, how ?
  4. Do the answers to these questions differ when the unlocked package has a namespace or when it does not have one ?

#LWC Component

 

cc @LWC @LWC Patterns @Lightning Web Components

7 answers
0/9000