GlideRecord get - Did You Know

Поділитися
Вставка
  • Опубліковано 1 гру 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..