0

I created a LWC that contains html, js and Apex. I know how to use change sets to migrate Visualforce but I am not sure how to push JS and HTML to Production. Is this possible using Change Sets?

enter image description here

2

You're already using VS Code, so just deploy it from there:

sfdx force:source:deploy -l RunLocalTests -p force-app/main/default/lwc/lWC_PriceBooks -w 10 -u production

Where:

  • -l RunLocalTests will specify that all tests should run, if necessary, you may want to change this.
  • -p force-app/main/default/lwc/lWC_PriceBooks is the path to the files to deploy.
  • -w 10 specifies a wait time of 10 minutes (if you have large deploys, you may adjust this).
  • -u production is an alias to your production org where you want the code.

There's no need to get the Sandbox/Scratch Org involved at all, and since Change Sets can take significant time to upload, this saves you all the intermediate steps.

You may also want to look at Unlocked Packages in the future, they are really easy to use and provide more control over how you manage your metadata.

2
  • Do you have a good link for Unlock Packages?
    – CodeMonger
    Jun 9 at 4:05
  • @CodeMonger Sure, edited in a link to a ~1 hour trailhead module that goes over the basics.
    – sfdcfox
    Jun 9 at 4:20
2

Yes, it is possible.

DEPLOY LIGHTNING WEB COMPONENT USING CHANGE SET IN SALESFORCE

  1. From Setup, enter Outbound Change Sets in the Quick Find box, then select Outbound Change Sets.

  2. In the Change Sets list, click the name of a change set, or create a new one. Click Add to add components.

  3. Choose the type of component as Lightning Web Component Bundle and select the components you want to add, and then click Add to Change Set.

1
  • Right and that is what i thought but if i click that it says There are no remaining components of the selected type available to add to your change set.
    – CodeMonger
    Jun 9 at 3:17

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.