1

I am starting to work with the QuickBooks SDK, and so far I am able to query Employees no problem, like so:

_sessionManager.OpenConnection("", "<software>")
_sessionManager.BeginSession("", ENOpenMode.omDontCare)

Dim requestSet As IMsgSetRequest = GetLatestMsgSetRequest(_sessionManager)
' Initialize the message set request object
requestSet.Attributes.OnError = ENRqOnError.roeStop
Dim empQuery As IEmployeeQuery = requestSet.AppendEmployeeQueryRq()
' Do the request and get the response message set object
Dim responseSet As IMsgSetResponse = _sessionManager.DoRequests(requestSet)
Dim response As IResponse = responseSet.ResponseList.GetAt(0)

Dim empRetList As IEmployeeRetList = response.Detail
....
_sessionManager.EndSession()
_sessionManager.CloseConnection()

Which will give me a list of employees which I can iterate through. This works well for the basic employee data, such as name, date of birth, etc. but there is a EmployeePayrollInfo property that does not seem to be returned with the IEmployeeQuery.

I see that there is an interface IEmployeePayrollInfo but I have not as yet been able to figure out if there is a way to query it. I see that there are report related payroll info queries, but I am trying to query the EmployeePayrollInfo directly, to retrieve the vacation information. Is this something that can be done with QBFC?

EDIT

I was able to get this working, see accepted answer below.

dub stylee
  • 3,252
  • 5
  • 38
  • 59

2 Answers2

1

For anyone searching for the same functionality, the only information I was able to find seems to indicate that Intuit has specifically excluded this functionality from the QuickBooks SDK for security reasons. What we ended up doing to solve our problem is create a custom report in QuickBooks that included all of the information that we needed, exported it as a CSV file, and then import it accordingly in our software. Same end result, but a couple more steps than we were originally hoping for. Hopefully Intuit will change their mind about excluding this from the SDK.

UPDATE

I have finally been able to query the EmployeePayrollInfo, what was needed was adding "EmployeePayrollInfo" to the query itself like so:

empQuery.IncludeRetElementList.Add("EmployeePayrollInfo")

So now the code looks like this:

Dim sessionManager As New QBSessionManager
sessionManager.OpenConnection2("", "<software>", ENConnectionType.ctLocalQBD)
sessionManager.BeginSession("", ENOpenMode.omDontCare)

Dim requestSet As IMsgSetRequest = sessionManager.CreateMsgSetRequest("US", 12, 0)
requestSet.Attributes.OnError = ENRqOnError.roeStop

Dim empQuery As IEmployeeQuery = requestSet.AppendEmployeeQueryRq()
empQuery.IncludeRetElementList.Add("EmployeePayrollInfo") ' this line did the trick!

Dim responseSet As IMsgSetResponse = sessionManager.DoRequests(requestSet)
Dim response As IResponse = responseSet.ResponseList.GetAt(0)

Dim empRetList As IEmployeeRetList = response.Detail

If empRetList.Count > 0 Then
    For i As Integer = 0 To empRetList.Count - 1
        Dim emp As IEmployeeRet = empRetList.GetAt(i)

        If emp IsNot Nothing Then
            ' do something with the queried data
        End If
    Next
End If

sessionManager.EndSession()
sessionManager.CloseConnection()
dub stylee
  • 3,252
  • 5
  • 38
  • 59
  • Do you recall where you came across the info indicating that report functionality had been excluded? – dkichler Oct 13 '17 at 04:49
1
  1. Open Quickbooks.
  2. Go to the Edit menu and click Preferences.
  3. In the Preferences window, click Integrated Applications in the list on the left.
  4. Click the Company Preferences tab.
  5. Select the application with which you are connecting to QuickBooks.
  6. Click Properties.
  7. Check "Allow this application to access Social Security Numbers, customer credit card information, and other personal data"

The employee data should now include EmployeePayrollInfo. Please comment if this does not work.

antibrian
  • 346
  • 4
  • 12
  • 1
    I just noticed your answer, and wanted to let you know that this does not work. I already had allowed the application those permissions, but always get back `EmployeePayrollInfo = Nothing` – dub stylee Oct 09 '15 at 18:22