Programmer’s Guide

Transcription

Intuit QuickBooks SDK Programmer’s GuideVersion 13.0

SDK version 13.0, released November 2013. (c) 2013 Intuit Inc. All rightsreserved.QuickBooks and Intuit are registered trademarks of Intuit Inc. All othertrademarks are the property of their respective owners and should be treatedas such.Acknowledgement: This product includes software developed by the ApacheSoftware Foundation ( http://www.apache.org ) (c) 1999-2006 The ApacheSoftware Foundation. All rights reserved.Intuit Inc.P.O. Box 7850Mountain View, CA 94039-7850For more information about the QuickBooks SDK and the SDK documentation,visit http://developer.intuit.com/.

CONTENTSAbout This ManualWho Should Read This Manual? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19Before You Begin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19What’s New in This Guide?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20Chapter 1: Introduction to QBSDK ProgrammingWhat is the SDK? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .What Kinds of Integrations are Possible with the SDK? . . . . . . .Which QuickBooks Editions/Versions Support My Application? . .What’s Included in the QuickBooks SDK Package? . . . . . . . . . .What is the Onscreen Reference OSR? Why Must I Use It? . . . .How Does QuickBooks Toggling Affect My Application? . . . . . . .Do I Have to Use XML? Or are Convenience Libraries Available? .Which Programming Languages Can I Use? . . . . . . . . . . . . . . .What Do I Need to Know Before I Start Programming? . . . . . . .What Kind of Technical Support is Available? . . . . . . . . . . . . . .21222323242424252525Chapter 2: JumpstartAfter the Tech Overview and the SDK Essentials Video. . . . . . . . . . . . . . . . . . . . . . 27Chapter 3: The Communication Model and Ways of Implementing ItThe Basic Communication Pattern. . . . . . . . . . . . . . . . . . . . .Authorizations You Need to Know About . . . . . . . . . . . . . . . .Company Owner Authorization of SDK Applications . . . . . .Intuit Gateway Authorization of SDK Applications . . . . . . .Messages: The Content of the Communication . . . . . . . . . . . .What’s in a Message?. . . . . . . . . . . . . . . . . . . . . . . . . . .Ways to Implement Communication With QuickBooks . . . . . . .Desktop Applications Accessing Local QuickBooks . . . . . . .Web Services Accessing QuickBooks via QB Web Connector.292930303031313232.35353537384042Chapter 4: Specifying Authorization PreferencesHow the QuickBooks UI Supports Authorization/Access . . . . . .When is the Authorization Dialog Displayed?. . . . . . . . . . .The Default Authorization Dialog . . . . . . . . . . . . . . . . . . .How the AuthPreferences Object Works. . . . . . . . . . . . . . . . .How to Use the AuthPreferences Functionality. . . . . . . . . .What Happens as a Result of the AuthPreference Settings?Setting Authorization Preferences Within QuickBooks. . . . .Contents(c) 2013 Intuit Inc. All rights reserved.3

Chapter 5: Accessing Desktop QuickBooks EditionsUsing Java with QB SDK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .A Note About the Request Processor . . . . . . . . . . . . . . . . . . . . .How to Access QuickBooks . . . . . . . . . . . . . . . . . . . . . . . . . . . .VB Code Snippets for Access if You Use qbXML . . . . . . . . . . .VB Code Snippets for Access if You Use QBFC . . . . . . . . . . . .What Happens in the Call to BeginSession? . . . . . . . . . . . . . .Troubleshooting Errors in the BeginSession Call . . . . . . . . . . .Multiple Sessions versus a Single Session. . . . . . . . . . . . . . . . . .Using AuthFlags to Specify Support for QuickBooks Editions . . . . .Setting AuthFlags to Specify Support for a QuickBooks Edition.More Information about Login Modes . . . . . . . . . . . . . . . . . . . . .Setting Up Auto-Login. . . . . . . . . . . . . . . . . . . . . . . . . . . . .Only One Auto-Login User per Application . . . . . . . . . . . . . . .Limitations on Accessing Company Files . . . . . . . . . . . . . . . . . . .Allowing Application Access to Personal Data . . . . . . . . . . . . . . .Single-User vs. Multi-User Mode . . . . . . . . . . . . . . . . . . . . . . . .Trade-offs of Using Single-User Mode . . . . . . . . . . . . . . . . . .Microsoft Windows Vista & Windows 7 and UAC. . . . . . . . . . . . . . 45. 45. 46. 46. 47. 47. 48. 48. 49. 50. 51. 52. 53. 53. 54. 54. 55. 55. 57. 57. 58. 58. 59. 60. 61. 62. 62. 65. 68. 69. 72. 73. 73.Chapter 6: Building Requests In QBFC and in qbXMLA Few Notes About Using QBFC . . . . . . . . . . . . . . . . . . . .Building a Request using QBFC . . . . . . . . . . . . . . . . . . . .What You Need to Do in QBFC . . . . . . . . . . . . . . . . . .Sample: Building a SalesOrder Using QBFC . . . . . . . . .The Importance of the CreateMsgSetRequest Call . . . .Background Details About the MsgSetRequest Object . .Another View of the Message Set Request Structure . . .Building a qbXML Request . . . . . . . . . . . . . . . . . . . . . . .What You Need to Do in qbXML using a DOM Document.Chapter 7: Handling Responses Using QBFC or qbXMLProcessing a Response Using QBFC . . . . . . . . . . . . . . . . . . . .Background Information: Understanding IMsgSetResponse .Background Information II: IResponse . . . . . . . . . . . . . . .Processing a qbXML Response. . . . . . . . . . . . . . . . . . . . . . . .What You Need to Do to Process a Response in qbXML . . . .Processing a Response Message Set: Sample Code. . . . . . .Chapter 8: Creating QueriesWhen to Use a Query vs a Report . . . .Different Ways of Using Queries to GetGetting a Count of Query Objects . . . .Filters . . . . . . . . . . . . . . . . . . . . . . . . .4Contents(c) 2013 Intuit Inc. All rights reserved.the Same Data .75757676

Limiting the Number of Objects Returned . . . . . . . . . . . .Using Iterators to Walk Through Large Query Returns .Limiting Returned Data Using IncludeRetElement . . . .Using MaxReturned . . . . . . . . . . . . . . . . . . . . . . . . .List Queries: Commonly Used Filters. . . . . . . . . . . . . . . .ListID or FullName. . . . . . . . . . . . . . . . . . . . . . . . . .Active Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Filtering by Date Modified . . . . . . . . . . . . . . . . . . . . .Match Criterion for Names . . . . . . . . . . . . . . . . . . . .Ranges for Names . . . . . . . . . . . . . . . . . . . . . . . . . .Special Information Contained in an AccountRet ObjectSpecial Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Transaction Queries: Commonly Used Filters . . . . . . . . . .TxnID or Reference Number . . . . . . . . . . . . . . . . . . .Date Filters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Entity Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Account Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . .Reference Number Filters . . . . . . . . . . . . . . . . . . . . .Paid Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Requesting Additional Data . . . . . . . . . . . . . . . . . . . .Special Queries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .The Generic TransactionQuery. . . . . . . . . . . . . . . . . .TransactionQuery and Access Permissions . . . . . . . . .Filters for TransactionQuery . . . . . . . . . . . . . . . . . . Report . 93. 93. 94. 95. 95. 95. 96. 96. 97. 97. 98. 98. 99. 99. 99.103.104.105.105.105.105Chapter 9: Generating ReportsBefore You Begin . . . . . . . . . . . . . . . . . . . . . . . .Categories of Reports . . . . . . . . . . . . . . . . . . . . .General Summary Reports . . . . . . . . . . . . . . .Job Reports . . . . . . . . . . . . . . . . . . . . . . . . .Time Reports . . . . . . . . . . . . . . . . . . . . . . . .Aging Reports . . . . . . . . . . . . . . . . . . . . . . . .Budget Summary Reports. . . . . . . . . . . . . . . .General Detail Reports . . . . . . . . . . . . . . . . . .Payroll Summary Reports . . . . . . . . . . . . . . . .Payroll Detail Reports. . . . . . . . . . . . . . . . . . .Custom Summary and Detail Reports. . . . . . . .Default Reports . . . . . . . . . . . . . . . . . . . . . . . . .A Practical Approach . . . . . . . . . . . . . . . . . . . . . .Creating a Report Request . . . . . . . . . . . . . . . . . .Modifying a Profit and Loss Standard Report . . .Setting Up Filters for a Profit and Loss Standard“IncludeColumn” Field . . . . . . . . . . . . . . . . . .Required Filter for Certain Job Reports . . . . . . .Required Filter for Missing Checks Report . . . . .Example of a Report Request . . . . . . . . . . . . .Creating Requests for Budget Reports . . . . . . .Contents(c) 2013 Intuit Inc. All rights reserved.5

Interpreting the Report Response . . . . . . . . . . . . .Report Meta-data . . . . . . . . . . . . . . . . . . . . . .Report Data . . . . . . . . . . . . . . . . . . . . . . . . . .Example . . . . . . . . . . . . . . . . . . . . . . . . . . . .Enumerated Values for “ClearedStatus” Column .Transaction Detail Reports . . . . . . . . . . . . . . . .Order Column . . . . . . . . . . . . . . . . . . . . . . . .Including Personal Data in Reports . . . . . . . . . .Including Payroll Data in Reports . . . . . . . . . . .My Report Has No Data! . . . . . . . . . . . . . . . . .Valid Request Options for Individual Report Types . .107107109109110111113113114114115Chapter 10: Modifying and Deleting Transactions and List ObjectsModifying Objects in General . . . . . . . . . . . . . . . . . . . . . . .Edit Sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .One Way to Delete an Element’s Value . . . . . . . . . . . . . .Clearing References . . . . . . . . . . . . . . . . . . . . . . . . . . .Clearing Aggregates . . . . . . . . . . . . . . . . . . . . . . . . . . .How to Modify Transactions . . . . . . . . . . . . . . . . . . . . . . . .Parts of a Transaction . . . . . . . . . . . . . . . . . . . . . . . . . .Modifying the Body of a Transaction . . . . . . . . . . . . . . . .Modifying Transaction Body Without Modifying Line Items .Shortcut Way to Retaining a Line Item Exactly As Is . . . . .Modifying a Line Item . . . . . . . . . . . . . . . . . . . . . . . . . .Inserting a New Line Item In a Mod Operation . . . . . . . . .Deleting a Line Item . . . . . . . . . . . . . . . . . . . . . . . . . . .Example: Modifying Transaction Lines . . . . . . . . . . . . . . .Example: Modifying Groups within the Line Item Table . . .Example: Modifying Item Lines in an Item Group . . . . . . .About Modifying Rate, Quantity, and Amount Line Item Fields.Deleting an Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Must be in Single-User Mode (Except for Enterprise). . . . .Accountant Copy Restrictions . . . . . . . . . . . . . . . . . . . . .Locked Transactions . . . . . . . . . . . . . . . . . . . . . . . . . . .About Closed Transactions . . . . . . . . . . . . . . . . . . . . . . .About Permissions . . . . . . . . . . . . . . . . . . . . . . . . . . . .Voiding an Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . er 11: Data Ext: Using Custom Fields and Priva

SDK version 13.0, released November 2013. (c) 2013 Intuit Inc. All rights reserved. QuickBooks and Intuit are registered trademarks of Intuit Inc.