Skip to main content

#LWC27 debatiendo

#LWC #LWC Development #Apex What practical projects can help learners understand LWC lifecycle hooks, component communication, Lightning Data Service, wire adapters, and event handling, and how should they connect LWC components with Apex methods?

2 respuestas
  1. 17 oct, 4:23

    Hi @Sai Kumar Good question! The best way to learn LWC and Apex integration is to build small projects and gradually move to real-world scenarios.

    1. Recommended Practical Projects

    1. Account Search: Fetch Account records using Apex and @wire.
    2. Contact Management: Create, update, and delete Contacts using Lightning Data Service.
    3. Student Management: Practice parent-child communication using @api and custom events.
    4. Opportunity Dashboard: Display Opportunity data using Apex and refresh it after updates.

    2. Important Concepts to Practice

    • Lifecycle Hooks: connectedCallback() and renderedCallback().
    • Component Communication: @api and custom events.
    • Wire Adapters: Fetch Salesforce data using @wire.
    • Apex Integration: Use @AuraEnabled methods for server-side operations.
    • Error Handling: Handle exceptions and display meaningful messages.

    3. Official Salesforce Resources

    Start with an Account Search component, then build a complete Student Management application using LWC and Apex.

    Key Point: Don't just copy code from Trailhead. Practice writing code, debugging errors, and understanding how LWC communicates with Apex.

    Hope this helps!

    Venkat Yadav | SFDCINDIA

0/9000

Hi All - Greetings and I hope you all are doing well and good. 

 

I am working on LWC with VS Code - created scratch org and once the work with scratch org, I will be deploying the entire work in my development org, i just want to provide me some industry best practices so that i can be more vigilant towards my trails or workaround 

 

#Trailhead Challenges  #LWC Component  #LWC

1 respuesta
  1. 1 oct, 15:12

    Hi @Vivek Dayafule -  a few best practices would be:

    • Keep your source code in Git and use branches.
    • Use the scratch org as a disposable development environment.
    • Avoid hardcoding IDs, URLs, or credentials.
    • Use Custom Metadata/Named Credentials for environment-specific values.
    • Write Apex and Jest tests before deployment.
    • Validate metadata and run tests before deploying to the Dev Org.
    • Deploy only the required metadata instead of the entire org.

    This will keep your LWC development clean, reusable, and easier to maintain.

0/9000

I'm in an org using Omnistudio managed package, which means my LWCs do not have the ability to extend NavigationMixin, which would allow the use of OmniNextStep() 

 

According to

https://help.salesforce.com/s/articleView?id=xcloud.os_create_and_map_data_inside_the_custom_lwc_element.htm&type=5

 

 

it appears the only thing I am able to do is bubble an event to pass data. My LWC has a button, and the result of that button has data get bubbled up via an event. 

 

I would like my Omniscript to navigate to the next available step (Or a specific one if necessary) but do not know how to do that. Is it possible? Why would the managed package not give us the ability to let a standalone lwc navigate us to any extent? 

 

#Omnistudio  #Vlocity  #LWC

1 respuesta
  1. 6 oct, 10:07

    Hi Michael, 

     

    You don't need NavigationMixin — you need OmniscriptBaseMixin, which is purpose-built for exactly this (works with the managed package too). Your Custom LWC should import and extend it; that gives you omniNextStep(), omniPrevStep(), and omniNavigateTo(step) directly, no event bubbling required. 

     

    ```js 

    import { OmniscriptBaseMixin } from 'vlocity_cmt/omniscriptBaseMixin'; // or your org's namespace 

     

    export default class MyCustomLwc extends OmniscriptBaseMixin(LightningElement) { 

        nextButton(evt) { 

            this.omniNextStep(); 

        } 

     

        goToStep(evt) { 

            this.omniNavigateTo(this.omniScriptHeaderDef.asIndex + 1); // or a step element name as a string 

        } 

    } 

    ``` 

     

    Notes: 

    - omniNavigateTo(step) accepts either a numeric step index or a step's element name as a string. 

    - You can't auto-advance more than one step ahead with omniNavigateTo — it's restricted to adjacent navigation for state-integrity reasons. 

    - The same mixin also gives you methods to read/update the OmniScript's data JSON directly from your component, so you likely don't need the event-bubbling approach at all for data passing either — that's really meant for parent-to-child communication patterns, not LWC-to-OmniScript control. 

     

    To your "why doesn't the managed package allow it" question: it does — this isn't a restriction, it's just that NavigationMixin (the generic Salesforce page-navigation API) was never the right tool here. OmniscriptBaseMixin is the namespaced, OmniStudio-specific equivalent that handles step navigation plus data sync, which NavigationMixin was never designed to do. 

     

    Reference:

    https://help.salesforce.com/s/articleView?id=xcloud.os_extend_the_omniscriptbasemixin_component_17717.htm&language=en_US&type=5

0/9000

Hello Guys, 

 

I am using accApi and trying to open an agent from LWC but facing issue as the agent is not opening only the agentforce window is opening - after that as i select the agent -conversation starts. 

 

So basically in the lwc  : 

1. i am calling   --  import { open, execute, close } from 'lightning/accApi';  

2. and after getting the agent id from my apex class i doing below :  

 

           

await open(this.resolvedBotId); // i am getting the id from apex.

            console.log('Agent panel opened successfully.');

            const utterance = "Start";

            await execute(utterance, this.resolvedBotId);

            console.log('Agent successfully invoked with utterance:', utterance);

 

But i can open the agent window but proper agent is not selecting. 

 

#Agentforce  #LWC  #AgenticAI

8 respuestas
  1. 11 sept, 16:28

    @Manas Datta

     

     

    Thanks for testing that - a correct id still landing on the bare panel actually rules the id out and points to an enablement gap. open() drives the SAME native Agentforce side panel you'd get manually, and botId is only optional targeting - if that agent isn't the one wired to the panel for your running user, open() falls back to the default panel/picker no matter which id you pass. 

     

    Quick way to confirm: open the native Agentforce panel manually (the Agentforce icon, not your LWC). If it also drops you on a picker or the wrong agent, it's the setup, not your code - check the agent is Active, is the one enabled for the Agentforce panel in that org, and your running user has access to it (permission set + the agent's assigned users). Fix that and open(botId) will land on it. 

     

    If you need a specific agent guaranteed every time regardless of the panel, skip accApi and use the Agent API instead (Connect REST /einstein/ai-agent, or its Apex wrapper): you start a session against the exact agent id server-side and render the replies in your own LWC chat UI - no panel, no picker, fully deterministic.

0/9000

I'm trying to deploy some LWC components to another environment, this error message appears. 

The definition of the components is not corrupted, as I'm able to deploy the components on my org, this issue only appears from github actions and also when deploying the changes to another environment. I couldn't find information on the web about what this issue means, Has someone encountered this issue before? I'll appreciate any answer! 

 

#LWC  #Lightning Web Components  #Deployment

1 respuesta
  1. 18 sept, 20:26

    Check for following:

    1. Component is in proper folder structure ‘force-app/main/default/lwc/componentFolder/…’

    2. Check if your deployment method matches in both local to your ORG and GitHub action. Like may be in local you’re using component/folder deployment and in GitHub it got metadata deployed with some package.xml defined

    3. Check the sf-cli version on both your local and GitHub ‘sf --version’

    These’re the most common occurrence of this issue.

0/9000

🎥 I've started a YouTube channel — SalesforceDevDaily! 

 

Sharing the concepts, hacks, and lessons I've learned working as a Salesforce Developer — Apex, LWC, and real project tips. 

Channel Link:-

https://youtube.com/@salesforcedevdaily?si=33wpFFurKxhWvBEI

 

 

Subscribe and let's learn together! 🚀 

#Salesforce #Apex #LWC #Trailblazer

4 comentarios
  1. 11 sept, 13:47

    Congratulations on starting SalesforceDevDaily! 🎉 This is a great initiative, especially for developers looking to strengthen their Apex and LWC skills with practical, real-world insights. 

    Looking forward to learning from your content and seeing the upcoming videos. Wishing you lots of success with the channel! 🚀👏 

0/9000
junran jiao ha preguntado en #Salesforce

Google Chrome を使用した際に、ボタンのスタイルに実線の枠が表示されるのですが、どのように解消すればよいでしょうか。 

Google Chrome を使用した際に、ボタンのスタイルに実線の枠が表示されるのですが、どのように解消すればよいでしょうか。

 

 

 

#Salesforce  #LWC  #Trailhead

1 respuesta
  1. 7 sept, 16:07

    こんにちは、 

     

    これは公式のSalesforceドキュメントで確認できた事例ではありませんが、画像のパターンから判断すると、ページのCSS(スタイルシート)が正しく読み込まれず、ブラウザのデフォルトスタイルが表示されている可能性が高いです。「ユーザー名」「パスワード」が実線で囲まれた形で表示されるのは、HTMLの<fieldset><legend>要素にCSSが適用されない場合のブラウザ標準(未装飾)表示によく見られるパターンです。 

     

    確認・対処方法: 

    1. シークレットウィンドウ(Ctrl+Shift+N)で同じログインページを開いて再現するか確認 — 拡張機能やキャッシュの影響を切り分けられます。 

    2. Chrome拡張機能(特に広告ブロッカー、翻訳ツール、WhatFixなどの業務用拡張機能)を一時的に無効化して再読み込み — 拡張機能がページのCSS読み込みを妨げているケースが報告されています。 

    3. ブラウザのキャッシュとCookieをクリアしてから再読み込み。 

    4. 会社のプロキシ/セキュリティソフトが外部CSSリソースをブロックしていないか、社内IT部門に確認(企業ネットワーク環境でよくある原因です)。 

     

    上記で解決しない場合は、具体的な原因を断定できる公式情報が見つからなかったため、Salesforceサポートへの問い合わせをおすすめします。

0/9000

Hi Everyone,

I have an Experience Cloud site where the users are using the Customer Community Plus license.

I have a requirement to create a new Customer Community Plus user from an LWC/Apex component. As part of the user creation process, I need to select the appropriate Customer Community Plus Profile.

To populate the Profile selection, I need to fetch the available Profiles from the org using Apex.

I tried the following SOQL:

List<Profile> profiles = [

SELECT Id, Name

FROM Profile

];

However, when this code executes in the context of a Customer Community Plus user, I receive the following error:

sObject type 'Profile' is not supported

I also understand that Experience Cloud users have restrictions on accessing certain standard objects.

My questions are:

  1. Is there any way to grant a Customer Community Plus user access to the Profile sObject through a Profile, Permission Set, or any other Salesforce configuration?
  2. If direct access to the Profile object is not supported for Customer Community Plus users, what is the recommended Salesforce approach for retrieving the appropriate Customer Community Plus Profile when creating another user?
  3. Is there any supported Apex/API approach to retrieve the available Customer Community Plus Profiles without directly querying the Profile object?

My requirement is specifically:

Existing Customer Community Plus user → LWC/Apex → Create a new Customer Community Plus user → Select the appropriate Customer Community Plus Profile

Any guidance or recommended approach would be greatly appreciated.

Thanks! 

 

#Salesforce Developer  #LWC  #Profiles  #Experience Cloud

7 respuestas
  1. 7 sept, 10:13

    I am getting this below error  when I use Site.createExternalUser() .

    common.apex.runtime.impl.ExecutionException: [You are already logged in.]

      

    Please suggest

0/9000
4 respuestas
  1. 3 sept, 11:37

    Hi @Hitesh Sharma, 

      

    You can use 

    VS Code with the Salesforce Extension Pack and Salesforce CLI to retrieve Apex, LWC, and other metadata from your Salesforce org. 

    After authorizing the org, use SFDX: Retrieve Source from Org in VS Code to retrieve the required components. 

    For JSON files, it depends on where they are stored: 

    • Static Resource/LWC bundle → retrieve the corresponding metadata. 
    • Salesforce record/data → use SOQL, Data Loader, or another data-export tool. 

     

    Hope this helps! 

0/9000

Welcome to the #TrailblazerCommunity! 👋 Take a moment to introduce yourself below. 💙 

 

Tell us all about YOU:

What are you passionate about? 

What are you looking to learn? 

Where are you located? 

 

Feel free to connect with others in the thread! 👇 

 

UPDATE: To mute this post, click on the arrow on the top right then "Mute."

2014 comentarios
0/9000