Question

I have been working on trying to send a journal entry (JE) to QBO and I can't quite get a grasp on how to create the object completely.

So I have my overall JE object and set the base values in that. Then, in each JE object there is an array of Line objects that correspond to each line in the JEs. Each line then has a DetailType that needs to be set to JournalEntryLineDetail and then you are supposed to create JournalEntryLineDetail object that houses more information for the line. However, where do you put this JournalEntryLineDetail object in the Line object? Do you attach it to the Line.AnyIntuitObject object?

I've been reading over the documentation and there is like no definitive answer that says "this is where the JournalEntryLineDetail goes" and I can't find an answer anywhere.

I currently have something close to this:

Dim je As New Intuit.Ipp.Data.JournalEntry()
Dim l As New Intuit.Ipp.Data.Line()
Dim jeld As New Intuit.Ipp.Data.JournalEntryLineDetail()

je.PrivateNote = "Something"
je.TxnDate = Now

l.Description = "Something Squared"
l.Amount = 100000000.00
l.DetailType = Intuit.Ipp.Data.LineDetailTypeEnum.JournalEntryLineDetail

jeld.PostingType = Intuit.Ipp.Data.PostingTypeEnum.Credit
jeld.AccountRef = 80

'Line to put jeld into the line - This is what I don't know how to do.
je.Line = {l}

NOTE:
This code does not reflect my actual coding abilities in terms of naming conventions, simply threw it together to get an example up.

EDIT:
Intuit JE Doc
Intuit Line Doc

Was it helpful?

Solution

When creating a JournalEntry object and saving the lines to the object, you do need to save the JournalEntryLineDetail to the Line.AnyIntuitObject object.

OTHER TIPS

                        JournalEntry journalEntry = new JournalEntry();
                        journalEntry.Adjustment = true;
                        journalEntry.AdjustmentSpecified = true;
                        //journalEntry.JournalEntryEx = 

                        journalEntry.DocNumber = "DocNu1";
                        journalEntry.TxnDate = DateTime.UtcNow.Date;
                        journalEntry.TxnDateSpecified = true;
                        journalEntry.HomeTotalAmt = 100;
                        journalEntry.HomeTotalAmtSpecified = true;
                        journalEntry.TotalAmt = 100;
                        journalEntry.TotalAmtSpecified = true;
                        List<Line> lineList = new List<Line>();

                        Line debitLine = new Line();
                        debitLine.Description = "nov portion of rider insurance";
                        debitLine.Amount = new Decimal(100.00);
                        debitLine.AmountSpecified = true;
                        debitLine.DetailType = LineDetailTypeEnum.JournalEntryLineDetail;
                        debitLine.DetailTypeSpecified = true;
                        JournalEntryLineDetail journalEntryLineDetail = new JournalEntryLineDetail();
                        journalEntryLineDetail.PostingType = PostingTypeEnum.Debit;
                        journalEntryLineDetail.PostingTypeSpecified = true;
                        journalEntryLineDetail.AccountRef = new ReferenceType() { name = "Accumulated Depreciation", Value = "36" };
                        debitLine.AnyIntuitObject = journalEntryLineDetail;
                        lineList.Add(debitLine);

                        Line creditLine = new Line();
                        creditLine.Description = "nov portion of rider insurance";
                        creditLine.Amount = new Decimal(100.00);
                        creditLine.AmountSpecified = true;
                        creditLine.DetailType = LineDetailTypeEnum.JournalEntryLineDetail;
                        creditLine.DetailTypeSpecified = true;
                        JournalEntryLineDetail journalEntryLineDetailCredit = new JournalEntryLineDetail();
                        journalEntryLineDetailCredit.PostingType = PostingTypeEnum.Credit;
                        journalEntryLineDetailCredit.PostingTypeSpecified = true;
                        journalEntryLineDetailCredit.AccountRef = new ReferenceType() { name = "Accumulated Depreciation", Value = "36" };
                        creditLine.AnyIntuitObject = journalEntryLineDetailCredit;
                        lineList.Add(creditLine);

                        journalEntry.Line = lineList.ToArray();
                        JournalEntry result = commonServiceQBO.Add(journalEntry) as JournalEntry;

You can refer the above for dotnet.

I don't have any handly .Net code which creates JE object using devkit.

You may want to refer the following java code.

    public JournalEntry getJournalEntryFields() throws FMSException {
        JournalEntry journalEntry = new JournalEntry();

        Line line1 = new Line();
        line1.setDetailType(LineDetailTypeEnum.JOURNAL_ENTRY_LINE_DETAIL);
        JournalEntryLineDetail journalEntryLineDetail1 = new JournalEntryLineDetail();
        journalEntryLineDetail1.setPostingType(PostingTypeEnum.DEBIT);
        //Account debitAccount = qboHelper.getCashBankAccount();
        //journalEntryLineDetail1.setAccountRef(qboHelper.getAccountRef(debitAccount));


        ReferenceType accountReferenceType = new ReferenceType();
        accountReferenceType.setValue("10");
        accountReferenceType.setName("Dues and Subscriptions");
        journalEntryLineDetail1.setAccountRef(accountReferenceType);

        line1.setJournalEntryLineDetail(journalEntryLineDetail1);
        line1.setAmount(new BigDecimal("100.00"));

        Line line2 = new Line();
        line2.setDetailType(LineDetailTypeEnum.JOURNAL_ENTRY_LINE_DETAIL);
        JournalEntryLineDetail journalEntryLineDetail2 = new JournalEntryLineDetail();
        journalEntryLineDetail2.setPostingType(PostingTypeEnum.CREDIT);
//      /Account creditAccount = qboHelper.getCreditCardBankAccount();
        journalEntryLineDetail2.setAccountRef(accountReferenceType);

        line2.setJournalEntryLineDetail(journalEntryLineDetail2);
        line2.setAmount(new BigDecimal("100.00"));      

        List<Line> lines1 = new ArrayList<Line>();
        lines1.add(line1);
        lines1.add(line2);
        journalEntry.setLine(lines1);

        return journalEntry;
    }

Thanks

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top