//prototype, Class.create(), this, function() //Use the .prototype keyword and the Class.create() method to declare a regular library class containing various (non-AJAX) utility functions. //Use the this keyword to declare and utilize instance variables. var PhoenixUtilityFunctions = Class.create(); PhoenixUtilityFunctions.prototype = { initialize: function() { }, //Simple object-based function (method). getMyEmail: function(){ this.userRec = new GlideRecord('sys_user'); this.userRec.get(gs.getUserID()); return this.userRec.getDisplayValue('email'); }, //Simple method which accepts one parameter. getMyNameTwoWays: function(bFirstLast){ if (bFirstLast === undefined) {bFirstLast = true;} var vUserId = gs.getUserID(); this.userRec = new GlideRecord('sys_user'); this.userRec.get(vUserId); var vLastName = this.userRec.getDisplayValue("last_name"); var vFirstName = this.userRec.getDisplayValue("first_name"); var vCompleteName = vFirstName + " " + vLastName; if (! bFirstLast) { vCompleteName = vLastName + ", " + vFirstName; } return vCompleteName; }, type: 'PhoenixUtilityFunctions' };