I'm receiving an exception trying to a set G.09.01 section fee. (aggregated adjustment)
Here's an excerpt of a log for this exception
2021-02-18 16:18:23,721  ERROR CDFeesMerger [(null)] - Go for Order:111661-004946 f= 1004. t= default
2021-02-18 16:18:24,174  ERROR CDFeesMerger [(null)] - Go for Order:111661-004946 f= 1007. t= default
2021-02-18 16:18:25,440  ERROR CDFeesMerger [(null)] - Setting adjustment in order..
2021-02-18 16:18:25,596  ERROR CDFeesMerger [(null)] - General exception: Cannot access member.
2021-02-18 16:18:25,643  ERROR CDFeesMerger [(null)] - -StackTrace: at SoftPro.EntityModel.Field`1.set_Value(T value)
at EscrowDetailPayor.set_ProcessAs(ProcessAs )
at CallSite.Target(Closure , CallSite , Object , ProcessAs )
at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
at EncompassToSoftProMerge.FeeMerger.Merge(EncompassJsonModel EncompassObject, IOrder SPOrder) in C:\workspaces\TitleFeeCollaboration.Prod\CDFees\Helpers\FeeMerger.cs:line 1422
Here's the code:
var AdjustmentOrderLine = (dynamic)((IEnumerable)Lines).Cast<dynamic>()
.Where(p => p.Description == "Aggregate Adjustment" || (dynamic)((IEnumerable)p.Charges).Cast<dynamic>()
.Where(c => c.Description == "Aggregate Adjustment").ToList().Count() > 0).ToList().FirstOrDefault();
if (AdjustmentOrderLine != null)
if (EncompassObject.agregateAdjustment != 0)
_log.Error("Setting adjustment in order..");
AdjustmentOrderLine.Charges.BuyerPaidAtClosing = EncompassObject.agregateAdjustment; // HERE - 1422
//AdjustmentOrderLine.Charges.Contact = GetContact(Order, "L");
//AdjustmentOrderLine.Charges.Payors.Contact = GetContact(Order, "B");
AdjustmentOrderLine.Charges.Payors.ProcessAs = SoftPro.OrderTracking.Client.Orders.ProcessAs.ReduceFunds;
_log.Error("Failed to locate Aggregate Adjustment Line");
- The order is opened as writable :
Code: Select all
IOrderStore os = ... IOrder order = os.OpenOrder(... , OrderEditMode.ReadWrite);
- It is not a type issue coming from your method EncompassObject.agregateAdjustment. Replace your method with a constant.
Code: Select all
AdjustmentOrderLine.Charges.BuyerPaidAtClosing = 42m;
- It is not an issue with dynamics. Sometimes the DLR has issues resolving objects. Yes - I doubt this is the case but please make sure. (This code is from memory so it may not be perfect.)
Code: Select all
IOrderItem line = (IOrderItem)AdjustmentOrderLine; IList charges = (IList)line.GetProperty("Charges"); IOrderItem charge = (IOrderItem)charges; charge.SetProperty("BuyerPaidAtClosing", 42m);
- With a breakpoint set on the code line that breaks, use VS to look at the charges and make sure there is at least one charge associated with "AdjustmentOrderLine".
Just an update on this. I have tried all Bob suggestions however I'm still getting the same error. With a breakpoint before assigning the value I did some inspection and GetIsReadOnly of the property returns true.
My main concern is there is no way to tell why. Bob and I had a meeting and he explained to me that certain reasons on why this may be read only is due some security about the internals of the SP engine.
Still, this does not solve the issue of knowing why. Its kinda hard to explain to Business that something cannot be done just because. And of course, this becomes a dead end since there is no path to follow to solve this.