```Here's an example in VB: Shared Function GetNS...
# suitetalkapi
a
Copy code
Here's an example in VB:

Shared Function GetNSPaymentIndex(ByRef customerPaymentRecord As CustomerPayment, ByRef NS_invoice_internal_id As String) As Integer
    Dim idx As Integer
    Dim x As Integer
    x = 0
    idx = -1
    For Each item In customerPaymentRecord.applyList.apply
        If item.doc = NS_invoice_internal_id Then
            idx = x
        End If
        x = x + 1
    Next
    Return idx
End Function


idx = GetNSPaymentIndex(customerPaymentRecord, NS_invoice_internal_id)
If idx > -1 Then
    customerPaymentRecord.applyList.apply(idx).apply = True
    customerPaymentRecord.applyList.apply(idx).amount = Lb_Bank_inv_amt
    customerPaymentRecord.applyList.apply(idx).amountSpecified = True
    customerPaymentRecord.applyList.apply(idx).doc = NS_invoice_internal_id
    customerPaymentRecord.applyList.apply(idx).totalSpecified = False
    customerPaymentRecord.applyList.apply(idx).dueSpecified = False
    customerPaymentRecord.applyList.apply(idx).discSpecified = False
End If