Unable to set the CreditAmount in JournalLineItem for journals created with Business Rule
I can't seem to figure out why the CreditAmount in the JournalLineItem isn't reflecting the number that I assign to it. It's always zero no matter what. Is anyone experiencing this issue? see my code below.
Sub CreateJournal(ByVal si As SessionInfo)
Try
'Set up a new journal header.
Dim journalObjectHeader As New JournalHeader()
With journalObjectHeader
.Name = "Test_Journal"
.Description = "This is a test journal"
.WorkflowProfileID = si.WorkflowClusterPk.ProfileKey
.MemberIds.Scenario = si.WorkflowClusterPk.ScenarioKey
.MemberIds.Time = si.WorkflowClusterPk.TimeKey
.JournalStatus = JournalStatus.Working
.IsSingleEntity = False
End With
Dim journalObjectLineItems As New List(Of JournalLineItem)
'Create the first journal line item
Dim jnLineItem1 As New JournalLineItem
With jnLineItem1
.EntityId = BRApi.Finance.Members.GetMemberId(si, DimType.Entity.Id, "100_US")
.AccountId = BRApi.Finance.Members.GetMemberId(si, DimType.Account.Id, "10220030")
.FlowId = BRApi.Finance.Members.GetMemberId(si,DimType.Flow.Id, "EndBal")
.ICId= BRApi.Finance.Members.GetMemberId(si, DimType.IC.Id, "None")
.DebitAmount.Amount = 150
End With
journalObjectLineItems.Add(jnLineItem1)
'Create the 2nd journal line item
Dim jnLineItem2 As New JournalLineItem
With jnLineItem2
.EntityId = BRApi.Finance.Members.GetMemberId(si, DimType.Entity.Id, "100_US")
.AccountId = BRApi.Finance.Members.GetMemberId(si, DimType.Account.Id, "10220050")
.FlowId = BRApi.Finance.Members.GetMemberId(si,DimType.Flow.Id, "EndBal")
.ICId= BRApi.Finance.Members.GetMemberId(si, DimType.IC.Id, "None")
.CreditAmount.Amount = - 150
End With
journalObjectLineItems.Add(jnLineItem2)
'Create a new journal object
Dim journalObject As New Journal(journalObjectHeader, journalObjectLineItems)
'Save it
BRApi.Journals.Metadata.SaveJournalOrTemplateUsingIds(si, journalObject,False, True)
Catch ex As Exception
Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
End Try
End Sub