In order to have a batch automatically create default soft credits for constituents set up to do so, the OverrideDefaultSoftCredits property of each gift will need to be set to False before setting the Constituent ID property.  Once that has been done, at the end of processing for the gift the OverrideDefaultSoftCredits property will need to be set to True with the CBatchTemp's UpdatePromptFlag property set to ePromptFlag_SC.  The following code demonstrates the use of these properties:

Set oGift = oTempRec.DataObject
    With oGift
        oGift.OverrideDefaultSoftCredits = False
       
        'TSH  Setting the record ID will create default soft credits and matching gifts unless override is turned on
        .Fields(GIFT_fld_Constit_ID) = lRecID
        .Fields(GIFT_fld_Type) = moCTS.StaticTableTranslation(staticnumGiftTypes, staticentryGiftType_Cash)
        .Fields(GIFT_fld_GiftSubType) = ValidCodeTableEntry(moSC, tbnumGiftSubTypes, GST_ALBERT_LEA)
        .Fields(GIFT_fld_Date) = moFF.FormatDate(BBTrim(oBox.LockBox.Date), fmtDATEMDY)
       
        '' amount in lockbox has no decimals, ie $25 is represented as 2500
        .Fields(GIFT_fld_Amount) = CDbl(oBox.LockBox.Amount) / 100
           
        .Fields(GIFT_fld_Post_Status) = moCTS.StaticTableTranslation(staticnumPostStatus, staticentryPostStatusNotPosted)

        .Fields(GIFT_fld_Post_Date) = moFF.FormatDate(Now(), fmtDATEMDY)
       
        If Len(BBTrim(oBox.LockBox.FundID)) <> 0 Then
            .Fields(GIFT_fld_Fund) = moUtility.GetFundDescription(moUtility.GetFundID(BBTrim(oBox.LockBox.FundID), True), moUtility.FundUseShortDesc)

           
            If Len(.Fields(GIFT_fld_Fund)) = 0 Then
                sErrMsg = BBTrim(oBox.LockBox.FundID) & " is not a valid fund ID."
            Else
                If Len(BBTrim(oBox.LockBox.CampaignID)) <> 0 Then
                    .Fields(GIFT_fld_Campaign) = moUtility.GetCampaignDescription(moUtility.GetCampaignID(BBTrim(oBox.LockBox.CampaignID), True), moUtility.CampaignUseShortDesc)

                   
                    If Len(.Fields(GIFT_fld_Campaign)) = 0 Then
                        sErrMsg = IIf(sErrMsg <> "", vbCrLf, "") & sErrMsg & BBTrim(oBox.LockBox.CampaignID) & " is not a valid campaign ID."

                    End If
                End If
            End If
        End If
       
        …...
       
    End With
   
    oGift.OverrideDefaultSoftCredits = True
   
    moBatchTemp.SaveGift oGift, oTempRec.Fields(moBatchTemp.GetFA.Count + 2), eLoadForAll
    Set oTempRec.DataObject = oGift

    'TSH  Tell batch that soft credits are already done, otherwise showing the soft credit form in batch will add
    '   the default soft credits again
    moBatchTemp.UpdatePromptFlag ePromptFlag_SC, lBatchTempID

Blackbaud provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with Microsoft Visual Basic and the tools used to create and debug procedures.  Blackbaud Customer Support can help explain the functionality of a particular procedure but they will not modify, or assist you with modifying, these examples to provide additional functionality.  If you are interested in learning more about VBA and API modules, contact our Sales department at solutions@blackbaud.com.