Name

global.PwdDefaultUserAccountLookup

Description

This is the default script for user account lookup from a sys user id to the account in a credential store. The default mapping is to use user_name as the account name.

Script

var PwdDefaultUserAccountLookup = Class.create();
PwdDefaultUserAccountLookup.prototype = {
  category: 'password_reset.extension.user_account_lookup', // DO NOT REMOVE THIS LINE!

  initialize: function() {
  },
  
  /**********
   * Returns the credential-store account id for a given user
   * 
   * @param params.userId  The sys-id of the user being checked (table: sys_user)
   * @return               The credential-store account-id (string) for a given user
   **********/
  process: function(params) {
     return this.getAccountNameByUserSysId(params.userId);
  },	
  
  getAccountNameByUserSysId: function(userSysId) {
  	var gr = new GlideRecord('sys_user');
  	if (!gr.get(userSysId)) {
  		return '';
  	}
  	return gr.user_name;
  },

  type: 'PwdDefaultUserAccountLookup'
}

Sys ID

b6dc5193eb71010045e1a5115206fe28

Offical Documentation

Official Docs: