<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Urgent, Need to get a cost center value from user table in Developer forum</title>
    <link>https://www.servicenow.com/community/developer-forum/urgent-need-to-get-a-cost-center-value-from-user-table/m-p/1537689#M194615</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My requirement is need to auto populate manger detail when we select a name field.It should populate emailaddress,contact number, job title and cost center value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I am getting the cost center value as sys_id need to get the field value.My code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;g_form.setValue('newusermanager_costcentre',managerName.cost_center);&lt;/P&gt;</description>
    <pubDate>Fri, 13 Oct 2017 07:27:14 GMT</pubDate>
    <dc:creator>s_nandhini</dc:creator>
    <dc:date>2017-10-13T07:27:14Z</dc:date>
    <item>
      <title>Urgent, Need to get a cost center value from user table</title>
      <link>https://www.servicenow.com/community/developer-forum/urgent-need-to-get-a-cost-center-value-from-user-table/m-p/1537689#M194615</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My requirement is need to auto populate manger detail when we select a name field.It should populate emailaddress,contact number, job title and cost center value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I am getting the cost center value as sys_id need to get the field value.My code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;g_form.setValue('newusermanager_costcentre',managerName.cost_center);&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2017 07:27:14 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/urgent-need-to-get-a-cost-center-value-from-user-table/m-p/1537689#M194615</guid>
      <dc:creator>s_nandhini</dc:creator>
      <dc:date>2017-10-13T07:27:14Z</dc:date>
    </item>
    <item>
      <title>Re: Urgent, Need to get a cost center value from user table</title>
      <link>https://www.servicenow.com/community/developer-forum/urgent-need-to-get-a-cost-center-value-from-user-table/m-p/1537690#M194616</link>
      <description>&lt;P&gt;You need to use getReference() method . Since you have multiple values to fetch.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;You can use GlideAjax and call the script include in the client script&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 13 Oct 2017 07:29:09 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/urgent-need-to-get-a-cost-center-value-from-user-table/m-p/1537690#M194616</guid>
      <dc:creator>Harish KM</dc:creator>
      <dc:date>2017-10-13T07:29:09Z</dc:date>
    </item>
    <item>
      <title>Re: Urgent, Need to get a cost center value from user table</title>
      <link>https://www.servicenow.com/community/developer-forum/urgent-need-to-get-a-cost-center-value-from-user-table/m-p/1537691#M194617</link>
      <description>&lt;P&gt;&lt;SPAN class="kd" style="color: #008000; font-weight: bold;"&gt;You can not do dot walking upto 2nd level using getReference() function, in that case you need to have GlideAjax Call from your catalog client script, something like this should help you.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;SPAN class="kd" style="color: #008000; font-weight: bold;"&gt;Client Script:&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;function onChange(control, oldValue, newValue, isLoading, isTemplate) {&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;if (isLoading || newValue === '') {&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;return;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;}&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;var sys_id = g_form.getValue('manager_field_name');&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;var userDetails = new GlideAjax("DisplayUserDetails");&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;userDetails.addParam("sysparm_name", "getUserDetails");&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;userDetails.addParam("sysparm_sys_id", sys_id);&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;userDetails.getXML(ajaxResponse);&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;function ajaxResponse(serverResponse) {&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;var answer = serverResponse.responseXML.documentElement.getAttribute("answer");&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;SPAN style="color: #666666; font-family: arial, sans-serif;"&gt;g_form.setValue('newusermanager_costcentre', answer);&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;}&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;}&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;STRONG&gt;Client Callable Script Include:&lt;/STRONG&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;var DisplayUserDetails = Class.create();&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;DisplayUserDetails.prototype = Object.extendsObject(AbstractAjaxProcessor, {&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;getUserDetails : function() {&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;var newUserRecord = new GlideRecord('sys_user');&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;if(newUserRecord.get(this.getParameter('sysparm_sys_id'))){&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;return newUserRecord.getDisplayValue('cost_center');&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;}&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;},&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;type: 'DisplayUserDetails'&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;});&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 13 Oct 2017 07:58:10 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/urgent-need-to-get-a-cost-center-value-from-user-table/m-p/1537691#M194617</guid>
      <dc:creator>Shishir Srivast</dc:creator>
      <dc:date>2017-10-13T07:58:10Z</dc:date>
    </item>
  </channel>
</rss>

