Name

global.PwdResetAccessLogHelper

Description

manager for Access Log creation

Script

var PwdResetAccessLogHelper = Class.create();

/*
  in case of an error:
  returns: {
  	
  		status,
  		error
  }
  or id

*/
PwdResetAccessLogHelper.initLog = function(sysparm_url, userAgent) {
  
  var gr = new GlideRecord("pwd_access_log");
  gr.url_suffix = sysparm_url;
  gr.user_agent = userAgent;
  var id = gr.insert();
  if (id == undefined) 
  	return {status: PwdConstants.WIN_STATUS_ERROR, error: "unable_to_log_access"};
  
  // retrieve the same record that was just inserted (after business rule updated its "action"):
  if (!gr.get(id)) 
  	return {status: PwdConstants.WIN_STATUS_ERROR, error: "unable_to_log_access"};
  
  if (gr.getValue("action") != PwdConstants.WIN_ALLOWED) 
  	return {status: PwdConstants.WIN_STATUS_ERROR, error: "access_not_allowed"};
  
  return id;
  
};

Sys ID

69b2bf57537103003248cfa018dc3445

Offical Documentation

Official Docs: