GlideRecord get - Did You Know

แชร์
ฝัง
  • เผยแพร่เมื่อ 14 ธ.ค. 2024

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

  • @rayroulstone3565
    @rayroulstone3565 ปีที่แล้ว +1

    I have used get before but didn't know it could take two inputs. This is awesome.

  • @SteemanCodes
    @SteemanCodes ปีที่แล้ว

    Great, I didn't know about two params, its awesome, Next time will use it.
    Thanks for sharing Chuck, Lots of love

  • @vemulakondasubramanyam3747
    @vemulakondasubramanyam3747 ปีที่แล้ว +2

    Cool... two parameters nice feature.... can it be improved to have list of columns and list of their values ?

    • @ChuckTomasi
      @ChuckTomasi ปีที่แล้ว

      For the use case of getting specific fields/values, you might want to take a look at GlideQuery.

  • @samikshasaloni5913
    @samikshasaloni5913 ปีที่แล้ว

    Thia video is very useful for me because sometimes I forget to add the query() step.. It will work for if only noy for while.Is it?

    • @justinjoy1701
      @justinjoy1701 ปีที่แล้ว +2

      yes you only get back a single record, so no point in using while.

  • @aviramran157
    @aviramran157 ปีที่แล้ว +1

    Well known but you can't use it to update the record

    • @ChuckTomasi
      @ChuckTomasi ปีที่แล้ว

      As the method name implies... "get" to get information. update() is used to update a record. :) Sorry if there was any indication of misrepresenting what this video is about.

    • @aviramran157
      @aviramran157 ปีที่แล้ว

      ​@@ChuckTomasi
      It's all good!
      I just wrote it for clarification for others

  • @vibhamadaan
    @vibhamadaan ปีที่แล้ว

    I've used it in my code.

  • @vkachineni
    @vkachineni ปีที่แล้ว +1

    Shorten up the code Vs Performance. How is the performance of .get() compared to .query() and .next()? Chuck, What do you prefer?

    • @OneAndOnlyMe
      @OneAndOnlyMe ปีที่แล้ว

      There should be no difference betwen .get() and .query() as ultimately they will do the same query in the database. .get() is more elegant code as you can do "if (incident.get(id))..." rather than .addQuery() then .query() then .next().

    • @skillz0r10
      @skillz0r10 ปีที่แล้ว

      @@OneAndOnlyMe the fastest way to retrieve a single record is not mentioned here. If you are looking for performance, do a .query() after a .setLimit(1) followed by a if(next()). Run a background script with and without the setLimit(1) and check the difference. Specially in tables with a lot of data

    • @OneAndOnlyMe
      @OneAndOnlyMe ปีที่แล้ว +1

      @@skillz0r10 Having the right indexes configured is also a factor.

  • @fung5768
    @fung5768 ปีที่แล้ว

    Hmm, I posted a comment suggesting people not to use the Get method, and it got deleted.
    Really classic ServiceNow..