2 Replies · Latest reply on Dec 11, 2017 3:47 AM by tsoct

    In PA Breakdown, how can i get User Name from User ID

      Hello all, I need to display agent name instead of USER ID in the indicator.

      Hence I have created a script below to use jour_sys_created_by to lookup Name in the breakdown script.

      (ex: My indicator should show NAME instead of USER ID)

      While the jour_sys_created_by is a string, not a reference field, I am unable to use GetDisplayValue.

      I have then added a script below but PA is giving me an error message during job collection: Error during JavaScript evaluation com.snc.pa.dc.ScriptException: JavaScript evaluation returned: Undefined in script:

       

      Any idea with the error?

       

      The script of the breakdown:

      Resolved by using this script:

      function getUser(userName) {

           var grUs = new GlideRecord('sys_user');

           grUs.get('user_name',userName);

           return grUs.getValue('sys_id') || '';

      }

      getUser(current.jour_sys_created_by);