QuickBooks Integrator 2022 Java Edition
Version 22.0 [Build 8594]

AdjustInventory Class

Properties   Methods   Events   Config Settings   Errors  

The AdjustInventory class is used to adjust your inventory.

Syntax

inqb.Adjustinventory

Remarks

The AdjustInventory class is used to adjust your current inventory levels within QuickBooks by sending an Inventory Adjustment transaction. This class does not directly manipulate inventory items, but rather it sends and retrieves Inventory Adjustment transactions. Each Inventory Adjustment Transaction that is added to or retrieved from QuickBooks may contain one or more Adjustment Line Items. Once you have added list of inventory adjustment transactions using the Adjustments collection, set the AccountName and you may then Add the transaction to QuickBooks. Please note that only pre-existing inventory items may be adjusted. To add, get, or modify existing inventory items, please use the Item Class.

Required Fields (Add): AccountId or AccountName, and at least one Inventory Item (ItemId or ItemName), plus an NewQuantity and/or NewValue.

Supported Methods:Add, Get (Id), Cancel, Delete

Example class.AccountName = "Inventory Asset" '* class.Memo = "Small warehouse fire." class.Adjustments.Add(New Adjustment()) class.Adjustments(0).ItemName = "Hardware:Brass Hinges" '* class.Adjustments(0).NewQuantity(0) = "130" class.Add() '*: Item must already exist in QuickBooks.

Note: The QuickBooks company file must be open in single-user mode. You cannot adjust the inventory while the company file is open in multi-user mode. Also, the QuickBooks Inventory Adjustment form must not be open, or you will receive an error.

The AdjustInventory class supports a variety of other operations as well. The class's Get, Cancel, and Delete methods may be used to retrieve, cancel, and delete Inventory Adjustment transactions. The ObjSearch Class may be used to search for Inventory Adjustments in the QuickBooks database.

Property List


The following is the full list of the properties of the class with short descriptions. Click on the links for further details.

AccountIdReference to account from which funds are being drawn.
AccountNameReference to account from which funds are being drawn.
AdjustmentsNumber of adjustments for this transaction.
ClassIdReference to the class of the Inventory Adjustment.
ClassNameReference to the class of the Inventory Adjustment.
CustomerIdA reference to the customer or customer job.
CustomerNameA reference to the customer or customer job.
MemoMemo to appear on internal reports only.
QBConnectionStringAn aggregate consisting of various QuickBooks connection properties.
QBRequestAggregateThe request aggregate.
QBRequestIdThe Id of the next message to be sent to QuickBooks.
QBRequestModeDefines whether the request is made online or stored offline.
QBResponseAggregateThe last QBXML response aggregate received from QuickBooks.
QBXMLVersionThe version of QBXML used in the outgoing message.
RefIdAn alphanumerical identifier generated by the server.
RefNumberReference number for the transaction.
TransactionDateDate of transaction.

Method List


The following is the full list of the methods of the class with short descriptions. Click on the links for further details.

AddAdds the Inventory Adjustment into QuickBooks.
CancelCancels (voids) the transaction.
CheckRequestStatusChecks whether or not the specified request was processed by QuickBooks.
CloseQBConnectionCloses a persistent connection to QuickBooks.
ConfigSets or retrieves a configuration setting.
DeleteDeletes the record from QuickBooks.
GetGets a single record from QuickBooks.
GetCustomFieldGets a custom field value from QuickBooks.
ImportQBXMLImports a QBXML response aggregate.
OpenQBConnectionOpens a persistent connection to QuickBooks.
ResetResets all properties to their defaults.
SetCustomFieldSets a custom field value within QuickBooks.

Event List


The following is the full list of the events fired by the class with short descriptions. Click on the links for further details.

ErrorInformation about errors during data delivery.
SSLServerAuthenticationFired after the server presents its certificate to the client.
SSLStatusShows the progress of the secure connection.
StatusShows the progress of the QuickBooks connection.
WarningFired when a warning occurs.

Config Settings


The following is a list of config settings for the class with short descriptions. Click on the links for further details.

Adjustments[i].NewQuantityUsed to set the AdjustmentNewQuantity at index i as a string.
Adjustments[i].QuantityDifferenceUsed to set the AdjustmentQuantityDifference at index i as a string.
AppendAfterAppends an XML tag after the specified QBXML element.
AuthFlagsConnection Flags (use for QuickBooks Simple Start).
EditSequenceAn identifier for this copy of the object.
EnforceMaxLengthIndicates whether to enforce max lengths for QB Fields.
GetHighestVersionHighest QBXMLVersion supported by the installed instance of QuickBooks.
GetRequestProcessorDLLVersionReturns the version of the QB Request Processor that is installed on your system.
GetSupportedVersionsReturns a list of QBXMLVersions that are supported by QuickBooks.
IsReadOnlyThis causes the QuickBooks authorization dialog to display text informing the user that its access will be read-only.
PersonalDataPrefWhether the connecting application will require access to personal data such as SSN or credit card information.
QBConnectionModeThe mode of connection to QuickBooks.
QBFileStatusThe status of the company file as it pertains to accepting connections.
QBOpenCompanyFileThe file currently open in QuickBooks.
SendRawXMLSends specified XML to quickbooks without modification.
SSLAcceptServerCertThe SSL certificate being used by the QuickBooks Gateway (aka Remote Connector).
SSLAcceptServerCertFileThe SSL certificate file being used by the QuickBooks Gateway (aka Remote Connector).
StopOnErrorSpecifies how QuickBooks is to proceed if an error occurs in processing of the current request.
TimeCreatedThe time the object was created.
TimeModifiedThe time the object was created.
UnattendedModePrefWhether connecting while QuickBooks is closed is required or optional for the user.
UpdateAdjustInventoryUpdates the inventory adjustment in QuickBooks.
WarningCodesA comma-separated list of QuickBooks warning codes that should not result in an exception.
BuildInfoInformation about the product's build.
GUIAvailableTells the class whether or not a message loop is available for processing events.
LicenseInfoInformation about the current license.
MaskSensitiveWhether sensitive data is masked in log messages.
UseDaemonThreadsWhether threads created by the class are daemon threads.
UseInternalSecurityAPITells the class whether or not to use the system security libraries or an internal implementation.

AccountId Property (AdjustInventory Class)

Reference to account from which funds are being drawn.

Syntax


public String getAccountId();


public void setAccountId(String accountId);

Default Value

""

Remarks

A reference to an Expense or Income account from which the Inventory Adjustment affects. For example, "Inventory Asset". Id/Name Reference Properties

This property is used to reference an object that is already done within QuickBooks. This may be done with its Id (this property) or its full Name, for which a corresponding property is defined.

Using the Id is recommended when feasible, as the Id is guaranteed to never change once defined.

Setting the value of this property will set the corresponding Name property to an empty string. This property is required.

AccountName Property (AdjustInventory Class)

Reference to account from which funds are being drawn.

Syntax


public String getAccountName();


public void setAccountName(String accountName);

Default Value

""

Remarks

A reference to an Expense or Income account from which the Inventory Adjustment affects. For example, "Inventory Asset". Name/Id Reference Properties

This property is used to reference an object that is already done within QuickBooks. This may be done with its full Name (this property) or its Id, for which a corresponding property is defined. If Name is used, it must contain the full name of the object referred to, as generated by QuickBooks. For hierarchically defined objects, such as Customers, this includes the names of parent objects, and the full name can be determined by reading the FullName special field.

Setting the value of this property will set the corresponding Id property to an empty string. This property is required.

Adjustments Property (AdjustInventory Class)

Number of adjustments for this transaction.

Syntax


public AdjustmentList getAdjustments();


public void setAdjustments(AdjustmentList adjustments);

Remarks

This property contains a collection of individual inventory adjustments.

This property is not available at design time.

ClassId Property (AdjustInventory Class)

Reference to the class of the Inventory Adjustment.

Syntax


public String getClassId();


public void setClassId(String classId);

Default Value

""

Remarks

A reference to the class of this InventoryAdjustment. Used if class tracking is being done with the QuickBooks company.

Id/Name Reference Properties

This property is used to reference an object that is already done within QuickBooks. This may be done with its Id (this property) or its full Name, for which a corresponding property is defined.

Using the Id is recommended when feasible, as the Id is guaranteed to never change once defined.

Setting the value of this property will set the corresponding Name property to an empty string.

ClassName Property (AdjustInventory Class)

Reference to the class of the Inventory Adjustment.

Syntax


public String getClassName();


public void setClassName(String className);

Default Value

""

Remarks

A reference to the class of this InventoryAdjustment. Used if class tracking is being done with the QuickBooks company.

Id/Name Reference Properties

This property is used to reference an object that is already done within QuickBooks. This may be done with its Id (this property) or its full Name, for which a corresponding property is defined.

Using the Id is recommended when feasible, as the Id is guaranteed to never change once defined.

Setting the value of this property will set the corresponding Name property to an empty string.

CustomerId Property (AdjustInventory Class)

A reference to the customer or customer job.

Syntax


public String getCustomerId();


public void setCustomerId(String customerId);

Default Value

""

Remarks

The Customer property indicates the Customer who has purchased goods or services from the company.

Id/Name Reference Properties

This property is used to reference an object that is already done within QuickBooks. This may be done with its Id (this property) or its full Name, for which a corresponding property is defined.

Using the Id is recommended when feasible, as the Id is guaranteed to never change once defined.

Setting the value of this property will set the corresponding Name property to an empty string.

Either CustomerId or CustomerName is required.

CustomerName Property (AdjustInventory Class)

A reference to the customer or customer job.

Syntax


public String getCustomerName();


public void setCustomerName(String customerName);

Default Value

""

Remarks

The Customer property indicates the Customer who has purchased goods or services from the company.

Name/Id Reference Properties

This property is used to reference an object that is already done within QuickBooks. This may be done with its full Name (this property) or its Id, for which a corresponding property is defined. If Name is used, it must contain the full name of the object referred to, as generated by QuickBooks. For hierarchically defined objects, such as Customers, this includes the names of parent objects, and the full name can be determined by reading the FullName special field.

Setting the value of this property will set the corresponding Id property to an empty string.

Either CustomerId or CustomerName is required.

Memo Property (AdjustInventory Class)

Memo to appear on internal reports only.

Syntax


public String getMemo();


public void setMemo(String memo);

Default Value

""

Remarks

A memo to appear on internal reports. Will not appear to customers, vendors, etc.

QBConnectionString Property (AdjustInventory Class)

An aggregate consisting of various QuickBooks connection properties.

Syntax


public String getQBConnectionString();


public void setQBConnectionString(String QBConnectionString);

Default Value

""

Remarks

QBConnectionString allows the user to customize the application's interaction with QuickBooks.

The connection properties should be formatted in a sequence as follows:

propertyname = "propertyvalue" propertyname = "propertyvalue" ...

The order is irrelevant, and the whitespace around the equal sign is optional.

The following properties are currently supported:

ApplicationNameThe name of the developer's application. This name will appear when the application first connects to QuickBooks; QuickBooks will display this name and prompt the user to grant or refuse access.
CompanyFileThe name of the company file to open. If QuickBooks is not currently open with a company file, QuickBooks will be automatically opened in the background with the file specified. Do not set CompanyFile when QuickBooks is open; if QuickBooks is open through the application UI, only that company file may be used.

This setting is not applicable when communicating with QB Connector.

URLThe URL for the Remote Connector, e.g., 'http://localhost:2080'. If the URL is specified, the class will not communicate directly with QuickBooks, and will instead send a request to the specified web address. QuickBooks and the Remote Connector should be installed at the remote location, and if the connector is listening on the specified port, it will communicate the class's request to QuickBooks, and return the response.
UserA username for the Remote Connector connection (if required on the Connector side)
PasswordA password for the Remote Connector connection (if required on the Connector side)
TimeoutA timeout, in seconds, for the Remote Connector connection. If the Connector does not finish and respond within the chosen length of time, the class will generate an exception instead of hanging.
DelayAfterCloseA delay, in milliseconds, to be applied after each time a connection to QuickBooks is closed. If QuickBooks is generating internal errors (in particular with automatic login) setting this delay to a positive value may solve the problem.
FirewallHostContains the name or IP address of firewall. If a FirewallHost is given, the requested connections will be authenticated through the specified firewall when connecting.
FirewallPasswordContains a password if authentication is to be used when connecting through the firewall. If FirewallHost is specified, the FirewallUser and FirewallPassword configs are used to connect and authenticate to the given firewall. If the authentication fails, the class throws an exception.
FirewallPortContains the TCP port for the firewall FirewallHost. Note this is set automatically when FirewallType is set to a valid value.
FirewallTypeDetermines the type of firewall to connect through. Supported values are: 0 - no firewall (default), 1 - Tunneling proxy, 2 - SOCKS4 proxy, and 3 - SOCKS5 proxy. For the Tunneling proxy (1), the FirewallPort defaults to 80. For SOCKS4 (2) and SOCKS5 (3) the FirewallPort defaults to 1080.
FirewallUserContains a user name if authentication is to be used connecting through a firewall. If the FirewallHost is specified, the FirewallUser and FirewallPassword configs are used to connect and authenticate to the given firewall. If the authentication fails, the class throws an exception.
ProxyAuthorizationSupported values are 0 - Basic authorization, 1 - Digest authentication, 3 - No authentication, and 4 - NTLM authentication.
ProxyPasswordContains a password if authentication is to be used for the proxy.
ProxyPortContains the TCP port for a ProxyServer; (default 80).
ProxySSLDetermines when to use SSL for the connection to the proxy. The applicable values are 0 - Automatic (SSL for https URLs, non-SSL for http URLs), 1 - The connection is always SSL-enabled, 2 - SSL is not enabled for any connection, and 3 - Connection is through a tunneling proxy.
ProxyServerIf a ProxyServer is specified, then the HTTP request is sent to the proxy instead of the server otherwise specified. If the ProxyServer is set to a Domain Name, a DNS request is initiated and upon successful termination of the request, the ProxyServer is set to the corresponding address. If the search is not successful, an error is returned.
ProxyUserContains a user name, if authentication is to be used for the proxy.
LocalHostThe name of the local host or user-assigned IP interface through which connections are initiated or accepted.
LocalPortThe TCP port in the local host where the class binds.
UseRDSWhether to connect using Remote Data Sharing (RDS). If set to True, the class will attempt to connect using the RDS client installed on the machine. The RDS client and server must be configured separately. The default value is False.

QBRequestAggregate Property (AdjustInventory Class)

The request aggregate.

Syntax


public String getQBRequestAggregate();


public void setQBRequestAggregate(String QBRequestAggregate);

Default Value

""

Remarks

This property will be populated when QBRequestMode is set to rmOffline and a method is called. This is used when working with the QBWCServer class to generate requests to be sent to QuickBooks Web Connector.

This property is not available at design time.

QBRequestId Property (AdjustInventory Class)

The Id of the next message to be sent to QuickBooks.

Syntax


public String getQBRequestId();


public void setQBRequestId(String QBRequestId);

Default Value

""

Remarks

The next message Id to be sent to QuickBooks. Message Id's are used by CheckRequestStatus to check on the status of previously made requests.

This property allows the user to determine whether a previous request was successfully processed by QuickBooks. Ordinarily QuickBooks either processes requests successfully or returns an error, but in the event of a power outage or other system failure, QuickBooks might or might not have time to process a request before issuing a response.

QuickBooks stores internally a list of QBRequestIds for which it has processed a request, and updated its internal state accordingly. Use of this property in conjunction with CheckRequestStatus allows the user to query this internal list.

To enable error recovery, the user application should store the value of QBRequestId before submitting a request to QuickBooks. If a system failure occurs, CheckRequestStatus should be called with this value of QBRequestId to find whether the request was processed before the system failed.

Unique values for QBRequestId will be generated on startup and after each request to QuickBooks. The automatically generated value may be overwritten by the user. Error checking may be turned off by setting QBRequestId equal to the empty string. See CheckRequestStatus for more information on error recovery.

This property is not available at design time.

QBRequestMode Property (AdjustInventory Class)

Defines whether the request is made online or stored offline.

Syntax


public int getQBRequestMode();


public void setQBRequestMode(int QBRequestMode);


Enumerated values:
  public final static int rmOnline = 0;
  public final static int rmOffline = 1;

Default Value

0

Remarks

This property defines the behavior of the class when calling a method. Possible values are:

0 (rmOnline - default) The request is made normally.
1 (rmOffline) The request is generated but not sent, and QBRequestAggregate is populated.

The use of offline mode is required when using the QBWCServer class. This allows requests to be generated and passed to QuickBooks Web Connector through the QBWCServer class.

For normal communication to QuickBooks either directly or through the QBConnector application use the default online mode.

QBResponseAggregate Property (AdjustInventory Class)

The last QBXML response aggregate received from QuickBooks.

Syntax


public String getQBResponseAggregate();


public void setQBResponseAggregate(String QBResponseAggregate);

Default Value

""

Remarks

The last QBXML response aggregate received from QuickBooks. This property is set whenever a response is received from QuickBooks.

This property may also be set to a response aggregate. When set to a QBXML aggregate, such as a response from ObjSearch or QBWCServer the class will parse the response as if it had been received directly from QuickBooks and the applicable properties will be updated.

This property is not available at design time.

QBXMLVersion Property (AdjustInventory Class)

The version of QBXML used in the outgoing message.

Syntax


public String getQBXMLVersion();


public void setQBXMLVersion(String QBXMLVersion);

Default Value

"3.0"

Remarks

The version of QBXML used in the outgoing message. Except as noted in the documentation, a value of "1.1" will suffice for all requests, and for all versions of QuickBooks which support integrated applications.

With each release of QuickBooks since 2002, a corresponding version of the QuickBooks SDK has also been released: 1.0 for QuickBooks 2002, 2.0 for QuickBooks 2003, 3.0 for QuickBooks 2004, etc., up to 8.0 for QuickBooks 2009. In addition, each release of QuickBooks continues to support all earlier versions of the SDK, meaning that requests using version 1.1 of the QuickBooks SDK are supported by all versions of QuickBooks. However, new requests and newer fields in existing requests are only supported in later versions of the QuickBooks SDK. As such, it is recommended that you set the QBXMLVersion property to correspond to the version of QuickBooks you are interacting with. These values are:

QuickBooks 20021.0, 1.1
QuickBooks 20032.0
QuickBooks 20043.0
QuickBooks 20054.0, 4.1
QuickBooks 20065.0
QuickBooks 20076.0
QuickBooks 20087.0
QuickBooks 20098.0
QuickBooks 20109.0
QuickBooks 201110.0
QuickBooks 201211.0
QuickBooks 201312.0
QuickBooks 201413.0
QuickBooks 201514.0
QuickBooks 201615.0

In addition, versions of QuickBooks outside of the U.S. released before Quickbooks 2008 adhere to a different version of the QuickBooks SDK. These versions were updated with less frequency than the U.S. SDK, and may omit features introduced in later releases:

QuickBooks Canadian 2003CA2.0
QuickBooks Canadian 2004 to 2007CA3.0
QuickBooks UK 2003UK2.0
QuickBooks UK 2004 to 2007UK3.0
QuickBooks Australian 2003OZ2.0
QuickBooks Australian 2004 to 2007AU3.0

With the exception of Province in Address (set State) or EligibleForT4A in Vendor (set EligibleFor1099), Canadian-only fields are read-only and may be accessed with Config.

This property is not available at design time.

RefId Property (AdjustInventory Class)

An alphanumerical identifier generated by the server.

Syntax


public String getRefId();


Default Value

""

Remarks

An Id is an alphanumerical identifier assigned by the server whenever an object is added to QuickBooks. It is guaranteed to be unique across all objects of the same type.

This property is read-only and not available at design time.

RefNumber Property (AdjustInventory Class)

Reference number for the transaction.

Syntax


public String getRefNumber();


public void setRefNumber(String refNumber);

Default Value

""

Remarks

This is the reference number assigned to a transaction. Depending on the type of transaction, it appears in the QuickBooks user interface as Bill Number, Invoice Number, etc.

Reference numbers are alphanumeric strings and are not limited to actually being numbers.

For some types of transactions, if RefNumber is not assigned, QuickBooks will automatically assign a unique one. Reference numbers should generally be unique, but are not guaranteed to be so. It is recommended that applications generating their own reference numbers take steps to ensure their uniqueness.

TransactionDate Property (AdjustInventory Class)

Date of transaction.

Syntax


public String getTransactionDate();


public void setTransactionDate(String transactionDate);

Default Value

""

Remarks

The date of the transaction.

The standard formatting for dates is YYYY-MM-DD; i.e., September 2, 2002 is formatted as 2002-09-02. When getting the value of a date property, the date will always be in this format.

When setting the value of a date property, the formats MM-DD-YY, MM-DD-YYYY, MM/DD/YY, and MM/DD/YYYY are also acceptable. Dates in these formats will be automatically parsed and stored in YYYY-MM-DD format.

This property is required in Accounts Payable (Bill and VendorCredit) transactions. In other kinds of transactions this property is optional.

Add Method (Adjustinventory Class)

Adds the Inventory Adjustment into QuickBooks.

Syntax

public void add();

Remarks

Add is used to add an Inventory Adjustment transaction into to QuickBooks.

If QuickBooks is able to add the Inventory Adjustment, it will return a copy of the adjustment, and the values of all properties will be reset from the QuickBooks response. The QBResponseAggregate property will also be set to the entire QBXML aggregate received from QuickBooks.

Please note that this class is adding an inventory adjustment transaction into QuickBooks. This is fundamentally different from modifying an inventory item. QuickBooks does not allow the direct manipulation of inventory item quantities or values, but rather it maintains a history of the transactions that modify the inventory items.

Furthermore, these transactions record only the difference in value or quantity that was added or removed. Current and previous quantities and values for inventory items are not recorded or returned. Only the difference is recorded. Please see the QuantityDifference and ValueDifference fields for more information.

If QuickBooks is not able to add the Inventory Adjustment, the class will throws an exception.

Cancel Method (Adjustinventory Class)

Cancels (voids) the transaction.

Syntax

public void cancel();

Remarks

Cancel causes the transaction to be voided in QuickBooks. The amount of the transaction and all line item quantities are changed to zero, and the memo is changed to "VOID:". The transaction will not, however, be deleted.

The transaction canceled in QuickBooks is the one specified by RefId. If the value of RefId is known then Get should first be called to retrieve the transaction. Otherwise the ObjSearch class should be used to search for the desired transaction in the QuickBooks database.

As the QuickBooks response to Cancel does not include the updated transaction, the values of all properties are instead set to their defaults. To get a copy of the updated transaction, the value of RefId should first be stored, and then Get should be called.

CheckRequestStatus Method (Adjustinventory Class)

Checks whether or not the specified request was processed by QuickBooks.

Syntax

public String checkRequestStatus(String requestId);

Remarks

This method allows the user to determine whether a previous request was successfully processed by QuickBooks. Ordinarily QuickBooks either processes requests successfully or returns an error, but in the event of a power outage or other system failure, QuickBooks might or might not have time to process a request before issuing a response.

QuickBooks stores internally a list of QBRequestIds for which it has processed a request, and updated its internal state accordingly. Use of this method allows the user to query the list for any RequestId whose value is known.

The method returns a string corresponding to the result of the query. If the request was processed successfully, an empty string ("") will be returned. If the request was not processed, the string "Request not processed." will be returned. If the request was processed but an error occurred, a string containing the error code and a description will be returned; for example, "801: A QuickBooks internal error has occurred."

See QBRequestId for more information on error recovery.

CloseQBConnection Method (Adjustinventory Class)

Closes a persistent connection to QuickBooks.

Syntax

public void closeQBConnection();

Remarks

Invoking CloseQBConnection closes the QuickBooks connection specified in QBConnectionString. After the connection has been closed, the class will revert to its default behavior, and a new connection will be established for each request until QBConnectionString is invoked again.

In case the connection is already closed invoking CloseQBConnection will have no effect. Moreover, if multiple connections are open CloseQBConnection will only close the connection specified in QBConnectionString.

Be sure to always invoke this method after calling OpenQBConnection.

Config Method (Adjustinventory Class)

Sets or retrieves a configuration setting.

Syntax

public String config(String configurationString);

Remarks

Config is a generic method available in every class. It is used to set and retrieve configuration settings for the class.

These settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the class, access to these internal properties is provided through the Config method.

To set a configuration setting named PROPERTY, you must call Config("PROPERTY=VALUE"), where VALUE is the value of the setting expressed as a string. For boolean values, use the strings "True", "False", "0", "1", "Yes", or "No" (case does not matter).

To read (query) the value of a configuration setting, you must call Config("PROPERTY"). The value will be returned as a string.

Delete Method (Adjustinventory Class)

Deletes the record from QuickBooks.

Syntax

public void delete();

Remarks

Delete causes the object to be deleted in QuickBooks. After this method is called, the values of all fields will be reset to their defaults.

The object deleted in QuickBooks is the one specified by RefId. This read-only property may be assigned either by calling Get or by assigning the value of QBResponseAggregate.

A typical example: Customer.GetByName("John Smith") 'this will assign the RefId Customer.Delete() Deleting entity objects (Customer, Employee, and Vendor) requires that QuickBooks be open in single-user mode. Transaction objects, however, may be deleted while QuickBooks is in any mode.

Use this method with caution, as there is no way to recover deleted objects.

Get Method (Adjustinventory Class)

Gets a single record from QuickBooks.

Syntax

public void get(String id);

Remarks

Get may be used to retrieve a single Inventory Adjustment transaction from QuickBooks, based on its RefId. When the method is called, a search will be initiated for the requested object. If it is found, all properties of the class will be set to the information retrieved from QuickBooks. The QBResponseAggregate property will also be set to the entire QBXML aggregate received from QuickBooks.

Please note that this class is retrieving an inventory adjustment transaction from QuickBooks. This is fundamentally different from retrieving an inventory item. QuickBooks does not allow the direct manipulation of inventory item quantities or values, but rather it maintains a history of the transactions that modify the inventory items.

Therefore this Get operation takes the Id of a previous Inventory Adjustment Add, and returns all of the adjustments made in that transaction in the Adjustment line item properties. Any quantity or value differences for a particular inventory item will show up in the QuantityDifference and ValueDifference properties.

You can not set the Id parameter to the Id for an inventory item. This will result in an error. You must use the Item or ObjSearch classs to retrieve inventory items.

GetCustomField Method (Adjustinventory Class)

Gets a custom field value from QuickBooks.

Syntax

public String getCustomField(String fieldName);

Remarks

This method will get the value of a custom field, which has been defined by the user from within the QuickBooks UI.

To read the values of custom fields, be sure to set QBXMLVersion to at least "2.0" when retrieving data from QuickBooks. Then, QuickBooks will return custom field information, and it will be accessible through this method.

You may also invoke Config to read the value of custom fields. However, to set the value of custom fields you must set QBXMLVersion to at least "3.0" and invoke SetCustomField.

ImportQBXML Method (Adjustinventory Class)

Imports a QBXML response aggregate.

Syntax

public void importQBXML(String XMLData);

Remarks

This method imports a QBXML response aggregate. When called with a QBXML aggregate, such as a response from ObjSearch or QBWCServer the class will parse the response as if it had been received directly from QuickBooks and the applicable properties will be updated.

OpenQBConnection Method (Adjustinventory Class)

Opens a persistent connection to QuickBooks.

Syntax

public void openQBConnection();

Remarks

Invoking OpenQBConnection will open a persistent connection to QuickBooks. After invoking OpenQBConnection, all requests such as Get, Add, etc. will use the established connection until CloseQBConnection is invoked.

The effect of OpenQBConnection is to increase performance. If OpenQBConnection is not invoked, a connection to QuickBooks will automatically be created and destroyed each time the class communicates with QuickBooks. Using OpenQBConnection will be faster, particularly in the case of automatic login.

After OpenQBConnection is invoked, QuickBooks will issue a connection ticket, and it will be stored in QBConnectionString. When CloseQBConnection is invoked the ticket will be invalidated, and any further attempts to use it will fail.

Be sure to invoke CloseQBConnection when you have finished communicating with QuickBooks. Leaving an open QuickBooks connection may lock out other integrated applications, affect QuickBooks performance, or cause other problems.

Reset Method (Adjustinventory Class)

Resets all properties to their defaults.

Syntax

public void reset();

Remarks

This method resets the values of all properties (and all special fields) to their defaults.

After calling this method, the class may be reused as if it were newly created.

SetCustomField Method (Adjustinventory Class)

Sets a custom field value within QuickBooks.

Syntax

public void setCustomField(String fieldName, String fieldValue);

Remarks

This method requires QuickBooks 2004 or above, with QBXMLVersion set to at least "3.0".

This method will immediately set the value of a QuickBooks custom field, which has been defined by the user from within the QuickBooks UI. Before calling this method, the preceding operation must retrieve the object from QuickBooks, using Get, ObjSearch, etc. Then, you may use SetCustomField to set custom field values (the fields will be modified or added, as appropriate).

Note that invoking this method will create a connection to QuickBooks if one is not already in place.

Error Event (Adjustinventory Class)

Information about errors during data delivery.

Syntax

public class DefaultAdjustinventoryEventListener implements AdjustinventoryEventListener {
  ...
  public void error(AdjustinventoryErrorEvent e) {}
  ...
}

public class AdjustinventoryErrorEvent {
  public int errorCode;
  public String description;
}

Remarks

The Error event is fired in case of exceptional conditions during message processing.

ErrorCode contains an error code and Description contains a textual description of the error. For a list of valid error codes and their descriptions, please refer to the Error Codes section.

SSLServerAuthentication Event (Adjustinventory Class)

Fired after the server presents its certificate to the client.

Syntax

public class DefaultAdjustinventoryEventListener implements AdjustinventoryEventListener {
  ...
  public void SSLServerAuthentication(AdjustinventorySSLServerAuthenticationEvent e) {}
  ...
}

public class AdjustinventorySSLServerAuthenticationEvent {
  public byte[] certEncoded;
  public String certSubject;
  public String certIssuer;
  public String status;
  public boolean accept;
}

Remarks

This event is where the client can decide whether to continue with the connection process or not. The Accept parameter is a recommendation on whether to continue or close the connection. This is just a suggestion: application software must use its own logic to determine whether to continue or not.

When Accept is False, Status shows why the verification failed (otherwise, Status contains the string "OK"). If it is decided to continue, you can override and accept the certificate by setting the Accept parameter to True.

SSLStatus Event (Adjustinventory Class)

Shows the progress of the secure connection.

Syntax

public class DefaultAdjustinventoryEventListener implements AdjustinventoryEventListener {
  ...
  public void SSLStatus(AdjustinventorySSLStatusEvent e) {}
  ...
}

public class AdjustinventorySSLStatusEvent {
  public String message;
}

Remarks

The event is fired for informational and logging purposes only. Used to track the progress of the connection.

Status Event (Adjustinventory Class)

Shows the progress of the QuickBooks connection.

Syntax

public class DefaultAdjustinventoryEventListener implements AdjustinventoryEventListener {
  ...
  public void status(AdjustinventoryStatusEvent e) {}
  ...
}

public class AdjustinventoryStatusEvent {
  public String message;
}

Remarks

The event is fired for informational and logging purposes only. Used to track the progress of the connection.

Warning Event (Adjustinventory Class)

Fired when a warning occurs.

Syntax

public class DefaultAdjustinventoryEventListener implements AdjustinventoryEventListener {
  ...
  public void warning(AdjustinventoryWarningEvent e) {}
  ...
}

public class AdjustinventoryWarningEvent {
  public int code;
  public String description;
}

Remarks

The Warning event is fired when the class has produced, or will produce, possibly unexpected results.

Warnings may be generated by QuickBooks or the class. Starred warning codes correspond to warnings and warning codes generated by QuickBooks.

510*Object added successfully, but cannot now be read.
520*Insufficient permissions to get all data.
801 Unable to update field (name).
802Unable to parse name.

Unlisted QuickBooks warnings will cause the class to throw an exception instead.

Warning 801 will be thrown if the user attempts to Update properties that cannot be updated. For example, the following code will cause this warning to be fired: Customer1.GetByName("Joe Smith") Customer1.Email = "joe@abc.com" 'ok Customer1.CreditLimit = "200.00" 'Not used in Update operations! Customer1.Update() Only the email address will be updated, and the credit limit will be unchanged. Each property description for entity objects lists whether or not it is used in Update operations.

Adjustment Type

Represents one line of an inventory adjustment.

Remarks

This type allows you to adjust the value or quantity of a single inventory item, using the AdjustInventory class.

Fields

ItemId
String

Line item field: Reference to the kind of item to be adjusted.

Adjustment Line items represent either quantity or value adjustments made on an inventory item. The ItemId or ItemName represent which inventory item the adjustment is acting on, and NewQuantity and NewValue fields are used to indicate how much you wish to change either the quantity or the value of the specified inventory item. ValueDifference and QuantityDifference will be filled after a successful Get or Add.

ItemName
String

Line item field: Reference to the kind of item to be adjusted.

Adjustment Line items represent either quantity or value adjustments made on an inventory item. The ItemId or ItemName represent which inventory item the adjustment is acting on, and NewQuantity and NewValue fields are used to indicate how much you wish to change either the quantity or the value of the specified inventory item. ValueDifference and QuantityDifference will be filled after a successful Get or Add.

LineId
String

Identification number of the transaction line, returned in the response.

NewQuantity
String

Line item field: The new quantity for this adjustment.

When issuing an Inventory Quantity Adjustment or Value Adjustment, this is the new quantity for the inventory item indicated by ItemName and ItemId.

Either NewQuantity and/or NewValue must be specified for each Adjustment, or the class will throws an exception.

The default value of "" indicates that this field is not specified, and no new quantity will be sent.

NewValue
String

Line item field: New value of this adjustment.

The new total value of these inventory items (The new value does NOT have to equal QuantityOnHand times PurchaseCost).

If this field is specified, the component will send a ValueAdjustment request for this line. The NewQuantity field may be set in conjunction with the NewValue field, and so long as NewValue is not empty, a ValueAdjustment request will be sent for this line. However, if NewValue is empty a QuantityAdjustment will be sent instead.

Either NewQuantity and/or NewValue must be specified for each Adjustment, or the class will throws an exception.

The default value of "" indicates that this field is not specified, and no new value will be sent.

QuantityDifference
String

Line item field: The change in quantity for this adjustment.

After a successful Add or Get this field will contain either a positive or negative number that shows the change in quantity for this inventory item.

ValueDifference
String

Line item field: The change in total value for this adjustment.

After a successful Add or Get, this read-only field will contain either a positive or negative number that shows a change in the total value of the entire stock of this inventory item.

Constructors

public Adjustment();



Config Settings (Adjustinventory Class)

The class accepts one or more of the following configuration settings. Configuration settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the class, access to these internal properties is provided through the Config method.

AdjustInventory Config Settings

Adjustments[i].NewQuantity:   Used to set the AdjustmentNewQuantity at index i as a string.

Used when a fractional or string-based quantity is necessary. For example, "1.5" lbs.

Adjustments[i].QuantityDifference:   Used to set the AdjustmentQuantityDifference at index i as a string.

Used when a fractional or string-based quantity is necessary. For example, "1.5" lbs.

AppendAfter:   Appends an XML tag after the specified QBXML element.

Write-only; Appends the specified text after the specified QBXML element (whether the QBXML element is present). This may be useful to extend the functionality of the component beyond what is provided. Example: Control1.Config("AppendAfter:ListID=<WeirdNewField>abc</WeirdNewField>")

AuthFlags:   Connection Flags (use for QuickBooks Simple Start).

Since 2006, QuickBooks has allowed AuthFlags to be set before connecting to QuickBooks. By default, the class can connect to Pro, Premier, and Enterprise editions of QuickBooks. However, because QuickBooks Simple Start contains only a subset of the functionality that other desktop versions provide, Intuit does not allow COM connection to Simple Start unless these AuthFlags explicitly indicate you wish to support it.

A list of allowable AuthFlags is provided below.

"" or 0Do not send any auth flags
0x01Support QB Simple Start
0x02Support QB Pro
0x04Support QB Premier
0x08Support QB Enterprise
0x80000000Force Auth Dialog

To specify support for multiple editions, OR together the values for each edition.

NOTE: If the version of QuickBooks being used does not support AuthFlags, the contents of this config will be ignored. However, if QuickBooks does support this feature, setting "AuthFlags=1" (Support for Simple Start only) on a machine running QuickBooks 2013 Pro will result in an error message indicating that the Request Processor cannot be found.

EditSequence:   An identifier for this copy of the object.

Indicates the state of an object when doing an Update.

EnforceMaxLength:   Indicates whether to enforce max lengths for QB Fields.

If you change this setting to False, the class will no longer check (or error) when the length of a property exceeds the maximum length specified in the QuickBooks SDK.

GetHighestVersion:   Highest QBXMLVersion supported by the installed instance of QuickBooks.

If QuickBooks is installed on the system, this setting will retrieve the highest QBXMLVersion that may be used for sending transactions to QuickBooks.

GetRequestProcessorDLLVersion:   Returns the version of the QB Request Processor that is installed on your system.

GetSupportedVersions:   Returns a list of QBXMLVersions that are supported by QuickBooks.

If QuickBooks is installed on the system, this setting will retrieve a list of all supported QBXMLVersions that may be used for sending transactions to QuickBooks. While GetHighestVersion config returns only the highest QBXMLVersion supported, this config returns ALL supported QBXMLVersions. The list is delimited with '\n' (linefeed) characters.

IsReadOnly:   This causes the QuickBooks authorization dialog to display text informing the user that its access will be read-only.

The default value is false.

PersonalDataPref:   Whether the connecting application will require access to personal data such as SSN or credit card information.

This setting allows you to let the user know immediately whether your application requires access to personal data or not.

A list of available values is provided below.

pdpOptionalCauses the QuickBooks authorization dialog to display a checkbox for user selection asking whether the user wants to allow the application to access personal data.
pdpRequiredCauses the QuickBooks authorization dialog to not display the personal information checkbox for user selection, and instead display a warning that the application needs to access personal data.
pdpNotNeededCauses the QuickBooks authorization dialog to not display the personal information checkbox for user selection, and instead display an informational message that the application will NOT access personal data.

The default value is pdpOptional.

QBConnectionMode:   The mode of connection to QuickBooks.

Specifies whether the integrated application logs in using single-user or multi-user mode.

The following values are permitted:

0Don't Care
1Single-User Mode
2Multi-User Mode

About Single-User and Multi-User Modes

If the connection to QuickBooks is made in single-user mode, QuickBooks will give exclusive access to the connecting application. It will lock out all other integrated applications; if QuickBooks and the company file are not already open in single-user mode by the QuickBooks user, the user will be locked out as well.

If the connection is made in multi-user mode, QuickBooks will allow all other integrated applications access. QuickBooks end users on other machines will also be allowed to access the file. However, if the application (rather than the end user) starts QuickBooks automatically, end users on the same machine will still be locked out.

If cmDontCare is specified, an appropriate connection mode will be chosen automatically. If a company file is open in either single-user or multi-user mode, the integrated application will accept that connection mode. If no company file is open, QuickBooks will login automatically in multi-user mode.

About Integrated and Automatic Login

Note that your application's login to QuickBooks might be either automatic or interactive. Interactive login is used when QuickBooks is already open. Access will be shared between the integrated application and the QuickBooks end user, and if multi-user mode is specified, other applications and users will have access as well. When a connection is made, QuickBooks will show a dialog window to the user, and ask the user if he/she wants to permit the connection.

Automatic login is used when QuickBooks is not already open. QuickBooks will be opened in the background, and will run until your application has finished its connection with QuickBooks. The QuickBooks user interface will not be displayed, and end-users on the same machine will be locked out. End-users on other machines, however, will be allowed access if multi-user mode is specified.

By default integrated applications do not have permission to login automatically. The first time an application interacts with QuickBooks, it must do so interactively, with QuickBooks and the company file open. The QuickBooks end user may then grant automatic login permission through Edit Preferences - Integrated Applications in the QuickBooks user interface. Click on the name of the application and then "Properties", and you may allow the application to login automatically.

For automatic login the CompanyFile must be specified. CompanyFile, ApplicationName, and other properties relating to the QuickBooks connection may be edited through QBConnectionString.

QBFileStatus:   The status of the company file as it pertains to accepting connections.

This setting may be queried before attempting to connect to QuickBooks to determine the current company file status. When queried the class will attempt to determine whether a subsequent connection using the provided QBConnectionString value would succeed. Possible return values are:

0 The company file will accept the connection. This indicates that no company file is open, or the desired company file is already open.
1 The company file will not accept the connection. This indicates a different company file is already open.

QBOpenCompanyFile:   The file currently open in QuickBooks.

The name of the file currently open in QuickBooks, specified completely with the path. This field is read-only.

A query is submitted to QuickBooks when the value of this property is read. The empty string will be returned if no file is open, if QuickBooks is open in an access mode incompatible with QBConnectionMode, or if an error occurs.

If the value of this property is nonempty, the class may interact exclusively with the open file.

SendRawXML:   Sends specified XML to quickbooks without modification.

Available for write only. Immediately sends the specified XML over the current or default QuickBooks connection (as specified elsewhere), and returns the QBXML response. Syntax: Control1.Config("SendRawXML=<?xml version="1.0" ?>...")

SSLAcceptServerCert:   The SSL certificate being used by the QuickBooks Gateway (aka Remote Connector).

The Base-64 encoded certificate being used by the Remote Connector (you may get this certificate from the Remote Connector by going to the Security tab, and clicking Export.)

This is only necessary if using a self-signed certificate, or any other certificate that has not been signed by a Certificate Authority (CA) trusted by the system.

SSLAcceptServerCertFile:   The SSL certificate file being used by the QuickBooks Gateway (aka Remote Connector).

If your public key certificate is stored in a file, you may set this configuration setting to the full path of the certificate, and it will be immediately read from disk and stored in SSLAcceptServerCert. Equivalent to setting SSLAcceptServerCert to file contents.

Reading the value of this setting will return an empty string.

StopOnError:   Specifies how QuickBooks is to proceed if an error occurs in processing of the current request.

If StopOnError is True (default), QuickBooks will stop processing when an error occurs. Requests that have already been processed will not be rolled back. An error is returned for the operation that caused the error condition. If StopOnError is False, QuickBooks will continue processing the remaining requests if an error occurs.

TimeCreated:   The time the object was created.

This config setting is read-only.

TimeModified:   The time the object was created.

This config setting is read-only.

UnattendedModePref:   Whether connecting while QuickBooks is closed is required or optional for the user.

This setting allows you to let the user know immediately whether your application requires the ability to access QuickBooks while QuickBooks is closed.

A list of available values is provided below.

umpOptionalCauses the QuickBooks authorization dialog to display its default selections and let the user pick. Use this setting if you do not need unattended mode.
umpRequiredCauses the QuickBooks authorization dialog to display only the selection choices of "No" (no authorization) or "Yes, allow access even if QuickBooks is not running" (authorize unattended mode).

The default value is umpOptional.

UpdateAdjustInventory:   Updates the inventory adjustment in QuickBooks.

This config will immediately build and send an update request for the inventory adjustment to QuickBooks. The inventory adjustment will have its information updated based on the various property values.

If QuickBooks is able to update the object, it will return a copy of the object, and the values of all properties will be reset from the QuickBooks response. The QBResponseAggregate property will also be set to the entire QBXML aggregate received from QuickBooks.

QBXMLVersion must be set to "9.0" or greater to update an inventory adjustment.

WarningCodes:   A comma-separated list of QuickBooks warning codes that should not result in an exception.

By default, the class will throw an exception when a status code with severity "Warn" is returned in a QuickBooks response. Set this field to a comma-separated list of status codes that should not throw an exception if returned. Note that the QuickBooks response code is not necessarily the same as the exception code from the resulting exception.

Base Config Settings

BuildInfo:   Information about the product's build.

When queried, this setting will return a string containing information about the product's build.

GUIAvailable:   Tells the class whether or not a message loop is available for processing events.

In a GUI-based application, long-running blocking operations may cause the application to stop responding to input until the operation returns. The class will attempt to discover whether or not the application has a message loop and, if one is discovered, it will process events in that message loop during any such blocking operation.

In some non-GUI applications, an invalid message loop may be discovered that will result in errant behavior. In these cases, setting GUIAvailable to false will ensure that the class does not attempt to process external events.

LicenseInfo:   Information about the current license.

When queried, this setting will return a string containing information about the license this instance of a class is using. It will return the following information:

  • Product: The product the license is for.
  • Product Key: The key the license was generated from.
  • License Source: Where the license was found (e.g., RuntimeLicense, License File).
  • License Type: The type of license installed (e.g., Royalty Free, Single Server).
  • Last Valid Build: The last valid build number for which the license will work.
MaskSensitive:   Whether sensitive data is masked in log messages.

In certain circumstances it may be beneficial to mask sensitive data, like passwords, in log messages. Set this to true to mask sensitive data. The default is true.

This setting only works on these classes: AS3Receiver, AS3Sender, Atom, Client(3DS), FTP, FTPServer, IMAP, OFTPClient, SSHClient, SCP, Server(3DS), Sexec, SFTP, SFTPServer, SSHServer, TCPClient, TCPServer.

UseDaemonThreads:   Whether threads created by the class are daemon threads.

If set to True (default), when the class creates a thread, the thread's Daemon property will be explicitly set to True. When set to False, the class will not set the Daemon property on the created thread. The default value is True.

UseInternalSecurityAPI:   Tells the class whether or not to use the system security libraries or an internal implementation.

When set to false, the class will use the system security libraries by default to perform cryptographic functions where applicable.

Setting this setting to true tells the class to use the internal implementation instead of using the system security libraries.

This setting is set to false by default on all platforms.

Trappable Errors (Adjustinventory Class)

Errors

The following errors may be generated by the class. Note that frequently the error message will contain more specific information than what is listed here.

AdjustInventory Errors

101   String too long.
103   Invalid date format (YYYY-MM-DD is standard).
104   Invalid value for enumerated field.
105   Invalid integer.
106   Invalid dollar amount.
107   Invalid boolean value (must be 'true' or 'false').
108   Invalid number.
111   Invalid special characters in string.
112   Invalid special field syntax.
181   Could not load certificate file.
201   Required field unspecified.
211   Unsupported field specified.
301   Array line count must be nonnegative.
302   Array index out of bounds.
303   Invalid field index.
401   Field not accessible as a special field.
402   Write access attempted of readonly field.
403   Read access attempted of writeonly field.
421   The object cannot be modified.
511   The QBRequestId has been previously used. Please generate a new one.
601   Could not access QuickBooks.
602   Could not open specified file.
603   The version of QuickBooks currently being used is not supported.
604   QuickBooks has not been installed properly.
605   The specified file was of an incorrect version.
606   Could not start QuickBooks.
607   QuickBooks is open in a mode different than the one requested.
608   QuickBooks cannot currently be accessed.
609   An application name must be specified.
610   A file name must be specified if one is not currently open in QuickBooks.
611   Access denied.
612   QuickBooks is busy and cannot open your application in the mode requested.
699   The connection to QuickBooks has failed for an unknown reason.
702   The object requested does not exist in QuickBooks.
751   Unsupported QBXML version.
752   The QBXMLVersion chosen is insufficient to execute the request.
801   A QuickBooks internal error has occurred.
802   QuickBooks is not available due to a system-related problem.
803   The Id specified is invalid.
804   Invalid object name.
805   The name already exists in QuickBooks.
807   An object could not be found in QuickBooks.
808   A reference did not refer to an object that exists in QuickBooks.
809   The object is currently in use by the QuickBooks end user.
810   The object may not be added.
811   The object may not be updated because it is obsolete.
812   The address is invalid.
813   Permission to perform this operation is not granted.
814   The request has not been processed.
815   Time creation mismatch.
816   The feature is turned off or not enabled.
817   Permission level configured is insufficient for access.
818    The item specified was of an unknown type.
819   The object may not be changed.
820   An internal QuickBooks error has occurred.
821   An attempt was made to use a connection that was not properly initiated.
822   An attempt was made to use a connection that is invalid or was previously closed.
823   Not enough memory.
824   Unable to lock the necessary information to allow this application access to the company file. Try again later.
850   An older version of QuickBooks 2002 is being used. Please download the latest update from Intuit.
851   The QuickBooks request processor was not found. Check that QuickBooks Pro 2002 or higher is installed on your system.
861   Server error on WebExport (details follow).
862   The WebExport is impossible: an HTTP context was not found.
871   You may not set the value of QBConnectionTicket. This value is readonly.
880   Interrupted by the user.
881   An error has occurred connecting to a remote machine.
899   An unknown QuickBooks error has occurred. The message contains more details.
901   XML Parser Error. Should not occur under normal circumstances.

Copyright (c) 2023 4D Payments Inc.
QuickBooks Integrator 2022 Java Edition - Version 22.0 [Build 8594]