Lightning Web Components:@Wire and Imperative Apex Server Calls in LWC

Поділитися
Вставка
  • Опубліковано 6 лют 2025

КОМЕНТАРІ • 34

  • @shreyaraut9270
    @shreyaraut9270 3 роки тому +7

    Just one day before I saw your video and next day the interviewer asked me to write the same program and I got the job 😀 Thanks you for the knowledge you shared 😊 👍

    • @sunilmithra7012
      @sunilmithra7012 3 роки тому

      Hi, Can you share the details of the program query you have been asked in the interview?

    • @shreyaraut9270
      @shreyaraut9270 3 роки тому +1

      write LWC to fetch account and related contacts.

    • @sunilmithra7012
      @sunilmithra7012 3 роки тому

      @@shreyaraut9270 thank you

    • @SALESFORCEPREDATOR
      @SALESFORCEPREDATOR  3 роки тому +1

      @shreya raut
      Thank you. I am glad it helped you. Congratulations for your job and all the best.

    • @kallurma
      @kallurma 3 роки тому

      Thank you for sharing the knowledge
      I have query how to get parent values when click on new child button(overridden) along with I need to add check box and radio group, input field how can I achieve this scenario

  • @chithraprakash8392
    @chithraprakash8392 Рік тому +1

    Thank you for making this very informative video. Please make more videos on LWC

  • @vineetsrivastava388
    @vineetsrivastava388 4 роки тому +1

    Very neatly explained. Will look out for the series on LWC from ur side.

  • @vijayank923
    @vijayank923 2 роки тому +2

    thank u... i am very clear about your explanation....

  • @malleshsalesforce1894
    @malleshsalesforce1894 Рік тому

    Thank you, great efforts .

  • @AlbertsWorld42
    @AlbertsWorld42 Рік тому

    Thanks a lot🙏

  • @shashis9131
    @shashis9131 4 роки тому +1

    Super simple explanation

  • @wamcy100
    @wamcy100 Рік тому

    I don't get what you are doing with the parameter Boolean in apex class method.

  • @arjunwalia737
    @arjunwalia737 11 місяців тому

    can you tell me what's the reason to write Aura or calling the LWC component in the Aura for writing Wire?

  • @ankitgupta0312
    @ankitgupta0312 3 роки тому

    Nice bro

  • @RajeshJhunjhunuwala
    @RajeshJhunjhunuwala 4 роки тому +1

    Excellent dear. Today it clear. Please upload about lwc event as well, will be highly appreciated

    • @SALESFORCEPREDATOR
      @SALESFORCEPREDATOR  4 роки тому +2

      Thank you :)@Rajesh. I have already added videos on events. ua-cam.com/video/Zews9NIg0N8/v-deo.html
      You can watch other videos on playlist for communication between lwc components.

  • @tomtam6
    @tomtam6 4 роки тому +1

    @19:54: What is the purpose of passing the Apex parameter, 'Boolean flag' into the Apex method, 'contactListCtrl.getContactList'? As I understand in your example, the showContact JS variable gets evaluated, then {flag: '$showContact'} gets passed into the @wire decorator and calls the getContactList Apex method. Is it just an example of showing how to pass a parameter to the Apex method that your example does not use?

    • @SALESFORCEPREDATOR
      @SALESFORCEPREDATOR  4 роки тому +2

      @Tom $showContact is a reactive an dynamic property here. So if we are using dynamic property in @wire apex class, whenever value of this property changes($showContact in our case), @wire call is executed. We have not used it in apex method as I just wanted to show how dynamic properties work. Let me give you example, lets say we have account searching application based on user input of account name value, so in that case we can bind this input value to dynamic property so we do not have to use imperative call and @wire will be executed whenever user changes value on UI .

  • @kishoretalari5984
    @kishoretalari5984 4 роки тому +1

    What is the main difference in wire and imperative. when we will go for the wire service ?

    • @SALESFORCEPREDATOR
      @SALESFORCEPREDATOR  4 роки тому +2

      @wire in general is used to fetch the data on load of components or if some parameters passed to apex method changes, so to bring fresh data.
      Imperative call can be used to fetch data, perform DML operations etc on some events say click of button.
      You cannot perform DML with @wire call.

    • @abhishekdalvi9564
      @abhishekdalvi9564 4 роки тому +1

      @@SALESFORCEPREDATOR This is exactly what I was looking for.
      Thank you.

  • @lordshiva4615
    @lordshiva4615 3 роки тому

    How to get the text out of a formula field and pass that text as an argument in the Apex class.(query used is field INCLUDES stringvalue). If you post a video like this. That will be helpful.

  • @teja7703
    @teja7703 4 роки тому

    Can we use both imparative and wire method in same js file??

    • @SALESFORCEPREDATOR
      @SALESFORCEPREDATOR  4 роки тому

      @teja Yes, definitely there is no such restrictions.

    • @teja7703
      @teja7703 4 роки тому

      @@SALESFORCEPREDATOR tq

  • @FACTS-do8zy
    @FACTS-do8zy 3 роки тому +1

    While using @wire, on server method we need to use cacheable = true and it is mandatory.
    While using imperative method, it is not mandatory

    • @SALESFORCEPREDATOR
      @SALESFORCEPREDATOR  3 роки тому

      That is correct. If we want cache to be there then we can mark server side method as cacheable while using imperative approach also.
      But in that case the result returned by method would be immutable and we cannot modify it directly, also we cannot perform any DML operations ,similar to in case of working with @wire

  • @chaitanyabollamreddi1284
    @chaitanyabollamreddi1284 3 роки тому

    Event is deprecated

  • @amitr9941
    @amitr9941 3 роки тому +1

    You are just copying and pasting the code.. You are not at all explaining what is happening in each line of your code specially in JS part.

    • @SALESFORCEPREDATOR
      @SALESFORCEPREDATOR  3 роки тому +4

      Hi @Amit, I tried explaining each line and also explained in presentation.May be I missed some point.Let me know which part you couldn't understand, will definitely help you.
      Also, I will take this suggestion and improve from next time so it would be easier for you.