Issue while updating sponsorship "Amount"

Hi There,

We are trying to update sponsorship 'Amount' field from API using below code.

RecurringGiftEditForm2Data rgEdit = new RecurringGiftEditForm2Data();

RecurringGiftEditForm2Data.SPLITS_DATAITEM[] array = new RecurringGiftEditForm2Data.SPLITS_DATAITEM[1];

array[0] = new RecurringGiftEditForm2Data.SPLITS_DATAITEM();
array[0].DESIGNATIONID = new Guid("01500820-c7ac-4e9e-8706-dcd387d25f9f");
array[0].AMOUNT = new decimal(30 + 0.0);

rgEdit.SPLITS = array;
rgEdit.AMOUNT = new decimal(30 + 0.0);

We are getting following error 'You cannot delete a designation split that is referenced by a sponsorship.' while updating sponsorship amount.

Can anyone help us to update sponsorship 'Amount' field.

Comments

  • You need to load the data first, then update it. You would want to start by loading the data with

    var svc = new AppFxWebService(RequestContext);

    var loadReply = svc.DataFormLoad(new DataFormLoadRequest

    {

    FormID = new Guid("306117b1-990b-49a9-a836-9671acfd0ffe"),

    RecordID = recurringGiftID.ToString(),

    ExcludeValueTranslations = false

    });

    RecurringGiftEditForm2Data rgEdit = new RecurringGiftEditForm2Data();

    rgEdit .SetRequestContext(RequestContext);

    rgEdit .LoadFromDataFormItem(loadReply.DataFormItem);

    Once that data is loaded you can change the amount field and loop through the split fields and change the amounts. I believe the issue is from 2 issues, not loading the data first, so when you save it is overwriting the data, deleting the designation split that is referenced by a sponsorship. Then the second issue is if you did load the data you would be overwriting the data again.

    So make the change to load the data, then edit the array in the rgEdit object instead of creating a new array.

    @Sanjeev Mishra:

    Hi There,

    We are trying to update sponsorship 'Amount' field from API using below code.

    RecurringGiftEditForm2Data rgEdit = new RecurringGiftEditForm2Data();

    RecurringGiftEditForm2Data.SPLITS_DATAITEM[] array = new RecurringGiftEditForm2Data.SPLITS_DATAITEM[1];

    array[0] = new RecurringGiftEditForm2Data.SPLITS_DATAITEM();
    array[0].DESIGNATIONID = new Guid("01500820-c7ac-4e9e-8706-dcd387d25f9f");
    array[0].AMOUNT = new decimal(30 + 0.0);

    rgEdit.SPLITS = array;
    rgEdit.AMOUNT = new decimal(30 + 0.0);

    We are getting following error 'You cannot delete a designation split that is referenced by a sponsorship.' while updating sponsorship amount.

    Can anyone help us to update sponsorship 'Amount' field.