code: public void addAutoLoginHandler()
      {
          this.getMainRecord().addListener(new FileListener(null)
          {
              public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption)
              {   // Return an error to stop the change
                  int iErrorCode = super.doRecordChange(field, iChangeType, bDisplayOption);
                  if ((iChangeType == DBConstants.AFTER_ADD_TYPE) || (iChangeType == DBConstants.AFTER_UPDATE_TYPE))
                      if (iErrorCode == DBConstants.NORMAL_RETURN)
                  {
                      Record recUserInfo = this.getOwner();
                      Task task = recUserInfo.getTask();
                      String strUserName = recUserInfo.getField(UserInfo.ID).toString();
                      if ((strUserName == null) || (strUserName.length() == 0))
                          strUserName = recUserInfo.getLastModified(DBConstants.BOOKMARK_HANDLE).toString();
                      String strPassword = recUserInfo.getField(UserInfo.PASSWORD).toString();
                      iErrorCode = task.getApplication().login(task, strUserName, strPassword, task.getProperty(DBParams.DOMAIN));   // Always okay
                  }
                  return iErrorCode;
              }
          });
      }
docs: AddAutoLoginHandler Method.