How to get the record Id In LWC Quick Action

แชร์
ฝัง
  • เผยแพร่เมื่อ 25 มิ.ย. 2024

ความคิดเห็น • 7

  • @pradeepaksks-bx8ip
    @pradeepaksks-bx8ip 14 วันที่ผ่านมา +1

    How can we perform dml operation and rest callout in a single transaction from lwc

    • @salesforcein5minutes
      @salesforcein5minutes  13 วันที่ผ่านมา

      First make the dml and check if id is not null and then make immediately callout to the system if its not null

    • @awesomekj5812
      @awesomekj5812 13 วันที่ผ่านมา +1

      @@salesforcein5minutes won't you get PENDING TRANSACTION error ? I think standard practice is to always do callout first and then do the DML or just do the callout in future method.

    • @pradeepaksks-bx8ip
      @pradeepaksks-bx8ip 13 วันที่ผ่านมา +1

      @@salesforcein5minutes in LWC controller Execution will not wait until response received from the callout, and we need to handle the response received and need to convert it to json Object and then pass the returned value to the apex method imperatively, May be I think we need to make use of async and await or promise chain in this scenario, but I am not sure.

    • @salesforcein5minutes
      @salesforcein5minutes  13 วันที่ผ่านมา

      @@awesomekj5812 yeah but we check id is there or not and after that we make a callout, basically if id was available that means record creation is done successfully and that operation is done

    • @salesforcein5minutes
      @salesforcein5minutes  13 วันที่ผ่านมา

      @@pradeepaksks-bx8ip you can also use platform. Events for such cases