on 11-05-2019 8:41 AM
Hi,
This is how you can manage the documents to add in Reference.
Here I have done this, after adding an adjustment journal entry I have tagged that to respective A/R Invoice's Reference Document i.e. in INV21.
This below workout code is in C# :-
int result = journalEntry.Add();
// Check if the journal entry was successfully added
if (result == 0)
{
// Get the generated JournalEntry number
string generatedJournalEntryNumber = company.GetNewObjectKey().ToString();
Console.WriteLine("Journal entry added successfully. Journal Entry Number: " + generatedJournalEntryNumber);
// Create a new line in INV21 table to establish the relation
Documents invLine = company.GetBusinessObject(BoObjectTypes.oInvoices);
invLine.GetByKey(invoiceEntry);
invLine.DocumentReferences.ReferencedObjectType = ReferencedObjectTypeEnum.rot_JournalEntry;
invLine.DocumentReferences.ReferencedDocEntry = Convert.ToInt32(generatedJournalEntryNumber);
invLine.DocumentReferences.IssueDate = DateTime.Today.AddDays(2);
invLine.DocumentReferences.Add();
int UpdateResult = invLine.Update();
if (UpdateResult == 0)
{
Console.WriteLine("Invoice line updated successfully with Journal Entry.");
}
else
{
int errorCode;
string errorMessage;
company.GetLastError(out errorCode, out errorMessage);
Console.WriteLine("Failed to update invoice line. Error Code: " + errorCode + ", Error Message: " + errorMessage);
}
}
else
{
int errorCode;
string errorMessage;
company.GetLastError(out errorCode, out errorMessage);
Console.WriteLine("Failed to add journal entry. Error Code: " + errorCode + ", Error Message: " + errorMessage);
company.Disconnect();
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
97 | |
10 | |
6 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.