servicenow getting value from extended table












0















Good Evening, I am sure this is a very simple question. But I am having no luck finding a correct answer.



I have onLoad client script on a request form. The form has a variable that I need to auto populate, the value is on a sys_user extended table.



I am not sure how to pull that value from the sys_user extended table.



I know to use a GlideRecord to get the current user on the sys_user, but after that is were I am having the issue.



Thanks for any help or suggestions you may have.



James










share|improve this question



























    0















    Good Evening, I am sure this is a very simple question. But I am having no luck finding a correct answer.



    I have onLoad client script on a request form. The form has a variable that I need to auto populate, the value is on a sys_user extended table.



    I am not sure how to pull that value from the sys_user extended table.



    I know to use a GlideRecord to get the current user on the sys_user, but after that is were I am having the issue.



    Thanks for any help or suggestions you may have.



    James










    share|improve this question

























      0












      0








      0








      Good Evening, I am sure this is a very simple question. But I am having no luck finding a correct answer.



      I have onLoad client script on a request form. The form has a variable that I need to auto populate, the value is on a sys_user extended table.



      I am not sure how to pull that value from the sys_user extended table.



      I know to use a GlideRecord to get the current user on the sys_user, but after that is were I am having the issue.



      Thanks for any help or suggestions you may have.



      James










      share|improve this question














      Good Evening, I am sure this is a very simple question. But I am having no luck finding a correct answer.



      I have onLoad client script on a request form. The form has a variable that I need to auto populate, the value is on a sys_user extended table.



      I am not sure how to pull that value from the sys_user extended table.



      I know to use a GlideRecord to get the current user on the sys_user, but after that is were I am having the issue.



      Thanks for any help or suggestions you may have.



      James







      servicenow






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 27 '18 at 22:54









      James TeaterJames Teater

      32




      32
























          1 Answer
          1






          active

          oldest

          votes


















          0














          As you mentioned, GlideRecord should be what you need to use. The exact script will vary based off of what field you are trying to query on your extended table.



          var gr = new GlideRecord("extended_table_name");
          gr.addQuery("field_name", "query");
          gr.query();
          if (gr.next()) {//action you want to take}


          You can add as many addQuery() methods as needed to build the query as specific as you require. The query() method then runs the query and return a new GlideRecord object. The .next() method checks to see if there is another record in the GlideRecord object and advances to the next record if so. After running the script above, you can access any properties on the GlideRecord you may need by simply dotwalking to them. i.e:



          sys_id = gr.sys_id;
          name = gr.getDisplayValue();





          share|improve this answer
























          • NOTE: Using GlideRecord client-side (like in an onLoad Client Script) makes a synchronous AJAX round trip to the server. You're probably better off using a combination of a "display" business rule, which allows you to push arbitrary key-value pairs to a scratchpad which is accessible client-side in the onLoad script via g_scratchpad.

            – Joey
            Nov 28 '18 at 17:23













          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53509493%2fservicenow-getting-value-from-extended-table%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          As you mentioned, GlideRecord should be what you need to use. The exact script will vary based off of what field you are trying to query on your extended table.



          var gr = new GlideRecord("extended_table_name");
          gr.addQuery("field_name", "query");
          gr.query();
          if (gr.next()) {//action you want to take}


          You can add as many addQuery() methods as needed to build the query as specific as you require. The query() method then runs the query and return a new GlideRecord object. The .next() method checks to see if there is another record in the GlideRecord object and advances to the next record if so. After running the script above, you can access any properties on the GlideRecord you may need by simply dotwalking to them. i.e:



          sys_id = gr.sys_id;
          name = gr.getDisplayValue();





          share|improve this answer
























          • NOTE: Using GlideRecord client-side (like in an onLoad Client Script) makes a synchronous AJAX round trip to the server. You're probably better off using a combination of a "display" business rule, which allows you to push arbitrary key-value pairs to a scratchpad which is accessible client-side in the onLoad script via g_scratchpad.

            – Joey
            Nov 28 '18 at 17:23


















          0














          As you mentioned, GlideRecord should be what you need to use. The exact script will vary based off of what field you are trying to query on your extended table.



          var gr = new GlideRecord("extended_table_name");
          gr.addQuery("field_name", "query");
          gr.query();
          if (gr.next()) {//action you want to take}


          You can add as many addQuery() methods as needed to build the query as specific as you require. The query() method then runs the query and return a new GlideRecord object. The .next() method checks to see if there is another record in the GlideRecord object and advances to the next record if so. After running the script above, you can access any properties on the GlideRecord you may need by simply dotwalking to them. i.e:



          sys_id = gr.sys_id;
          name = gr.getDisplayValue();





          share|improve this answer
























          • NOTE: Using GlideRecord client-side (like in an onLoad Client Script) makes a synchronous AJAX round trip to the server. You're probably better off using a combination of a "display" business rule, which allows you to push arbitrary key-value pairs to a scratchpad which is accessible client-side in the onLoad script via g_scratchpad.

            – Joey
            Nov 28 '18 at 17:23
















          0












          0








          0







          As you mentioned, GlideRecord should be what you need to use. The exact script will vary based off of what field you are trying to query on your extended table.



          var gr = new GlideRecord("extended_table_name");
          gr.addQuery("field_name", "query");
          gr.query();
          if (gr.next()) {//action you want to take}


          You can add as many addQuery() methods as needed to build the query as specific as you require. The query() method then runs the query and return a new GlideRecord object. The .next() method checks to see if there is another record in the GlideRecord object and advances to the next record if so. After running the script above, you can access any properties on the GlideRecord you may need by simply dotwalking to them. i.e:



          sys_id = gr.sys_id;
          name = gr.getDisplayValue();





          share|improve this answer













          As you mentioned, GlideRecord should be what you need to use. The exact script will vary based off of what field you are trying to query on your extended table.



          var gr = new GlideRecord("extended_table_name");
          gr.addQuery("field_name", "query");
          gr.query();
          if (gr.next()) {//action you want to take}


          You can add as many addQuery() methods as needed to build the query as specific as you require. The query() method then runs the query and return a new GlideRecord object. The .next() method checks to see if there is another record in the GlideRecord object and advances to the next record if so. After running the script above, you can access any properties on the GlideRecord you may need by simply dotwalking to them. i.e:



          sys_id = gr.sys_id;
          name = gr.getDisplayValue();






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 28 '18 at 13:17









          roadrunner343roadrunner343

          695




          695













          • NOTE: Using GlideRecord client-side (like in an onLoad Client Script) makes a synchronous AJAX round trip to the server. You're probably better off using a combination of a "display" business rule, which allows you to push arbitrary key-value pairs to a scratchpad which is accessible client-side in the onLoad script via g_scratchpad.

            – Joey
            Nov 28 '18 at 17:23





















          • NOTE: Using GlideRecord client-side (like in an onLoad Client Script) makes a synchronous AJAX round trip to the server. You're probably better off using a combination of a "display" business rule, which allows you to push arbitrary key-value pairs to a scratchpad which is accessible client-side in the onLoad script via g_scratchpad.

            – Joey
            Nov 28 '18 at 17:23



















          NOTE: Using GlideRecord client-side (like in an onLoad Client Script) makes a synchronous AJAX round trip to the server. You're probably better off using a combination of a "display" business rule, which allows you to push arbitrary key-value pairs to a scratchpad which is accessible client-side in the onLoad script via g_scratchpad.

          – Joey
          Nov 28 '18 at 17:23







          NOTE: Using GlideRecord client-side (like in an onLoad Client Script) makes a synchronous AJAX round trip to the server. You're probably better off using a combination of a "display" business rule, which allows you to push arbitrary key-value pairs to a scratchpad which is accessible client-side in the onLoad script via g_scratchpad.

          – Joey
          Nov 28 '18 at 17:23






















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53509493%2fservicenow-getting-value-from-extended-table%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Lallio

          Futebolista

          Jornalista