01-31-2008, 09:07 AM
|
#1 (permalink)
|
| Junior Member Join Date: Jan 2008 Location: Atlanta, GA
Posts: 12
Rep Power: 0  | API help with Gifts with Attribute Hi everyone,
I'm very new to RE and RE/VBA. I’m trying to create a small plug-in. It imports gifts. I have to use a batch. Each gift has an attribute with code CGO. When I save the gift directly (without batch) the attribute has been added correctly. But if I add the gifts to a batch and then submit the batch the attributes are missing. Probably my problem is how to add gift attribute filed to the batch.
I would appreciate any help. This is the code I use in order to create the batch:
Private Sub CreateNewBatch()
Dim BatchName As String
BatchName = "Custom Batch" + Date$ + " " + Time$
Set oBatch = New CBatchAPI
oBatch.Init REAPI.SessionContext
oBatch.Fields(BATCHAPI_fld_BATCH_NUMER) = BatchName
oBatch.Fields(BATCHAPI_fld_DESCRIPTION) = Some Gifts"
oBatch.Fields(BATCHAPI_fld_OTHERS_CAN_MODIFY) = True
'Add batch fields
Dim oBatchFields As CBatchFields
Set oBatchFields = oBatch.BatchFields
With oBatchFields
SetupBatchField .Add(), GIFT_fld_Constit_ID
SetupBatchField .Add(), GIFT_fld_Type
SetupBatchField .Add(), GIFT_fld_Amount
SetupBatchField .Add(), GIFT_fld_Payment_Type
SetupBatchField .Add(), GIFT_fld_Credit_Type
SetupBatchField .Add(), GIFT_fld_Credit_Card_Number
SetupBatchField .Add(), GIFT_fld_CardholderName
SetupBatchField .Add(), GIFT_fld_Expires_On
SetupBatchField .Add(), GIFT_fld_Authorization_Code
SetupBatchField .Add(), GIFT_fld_Date
SetupBatchField .Add(), GIFT_fld_Post_Date
SetupBatchField .Add(), GIFT_fld_Campaign
SetupBatchField .Add(), GIFT_fld_Fund
SetupBatchField .Add(), GIFT_fld_Appeal
SetupBatchField .Add(), GIFT_fld_Acknowledge_Date
SetupBatchField .Add(), GIFT_fld_Receipt_Number
SetupBatchField .Add(), GIFT_fld_Receipt_Amount
SetupBatchField .Add(), GIFT_fld_Post_Status
SetupBatchField .Add(), GIFT_fld_Reference ' ??????????????????????????????????????? ' ADD A gift attribute field - attribute code CGO
End With
oBatch.Save
Set oBatchFields = Nothing
Set oTempRecords = oBatch.TempRecords
End Sub
Private Sub SetupBatchField(ByVal oBatchField As CBatchField, ByVal lGiftField As EGiftFields)
With oBatchField
.Fields(BatchField_fld_MetaObjectId) = bbmoGIFT
.Fields(BatchField_fld_FieldNumber) = lGiftField
End With
End Sub
Thank you in advance!!!
__________________ Ivan Vasilev Database Manager USA, Atlanta, GA |