Hi,
It is not a known bug (at least to me), but I suspect if it was, it's very likely to be fixed in a later version. I would suggest you to try to upgrade to latest version to see if it gets fixed.
If upgrading is not possible for you - contact our developer support ticket for a workaround.
Hi David!
I have the exact same problem did you solve it?
It occours when I run the CartValidate workflow first time after compilation, eg going directly to the basket page after compiling. If I add an item to the cart before going to the basket page and the CartValidate it works just fine.
Any thoughts?
I'm running Commerce 10.7.
Thanks!
/Kristoffer
Maybe this helps. I had a simular problem, I accidentally used 'RewardDescription.CreateFreeItemReward' and not 'RewardDescription.CreateGiftItemsReward' in my custom promotion. That caused some weird problems later on, including the NullReference error.
Hi Rene!
I'm using the RewardDescription.CreateMoneyReward since it is money I want to create an amount. Maybe there is a problem with that one? Episerver is using RewardDescription.CreateMoneyOrPercentageRewardDescription but I need to manipulate the saved value and the SavedAmount is {get;} only.
@Quan, can I after using RewardDescription.CreateMoneyOrPercentageRewardDescription manipulate the saved amount? Now I do this since it is {get} only:
return RewardDescription.CreateMoneyReward( fulfillmentStatus, new List<RedemptionDescription> { redemptionDescription }, promotionData, amount, fulfillmentStatus.GetRewardDescriptionText(_localizationService));
Where amount is my manipulated amount. Should work just fine right?
/Kristoffer
Hi, I am running Episerver.Business.Commerce version 9.22 with EpiServer 9.12.1 on a site and we have set up a custom Order promotion with the VNext workflow, but it is throwing a NullReferenceException whenever we return a Fulfilled status on a RewardDescription from the Evaluate Function.
This is the code generating the RewardDescription that leads to the error:
The stack trace is as follows:
at EPiServer.Commerce.Marketing.OrderFormPriceMatrix.CalculateAndCommit(AffectedEntries item, Func`3 apply)
at EPiServer.Commerce.Marketing.OrderRewardApplicator.ApplyDiscount(AffectedOrder item, Decimal discountAmount, PromotionProcessorContext processorContext)
at EPiServer.Commerce.Marketing.RewardApplicatorBase`1.<>c__DisplayClass1_0.b__0(TAffectedObject item)
at EPiServer.Commerce.Marketing.RewardApplicatorBase`1.ForEach(Func`2 apply, IEnumerable`1 affectedItems)
at EPiServer.Commerce.Marketing.RewardApplicatorBase`1.Apply(RewardDescription reward, RedemptionDescription redemption, PromotionProcessorContext processorContext)
at EPiServer.Commerce.Marketing.RewardApplicatorBase`1.Apply(RewardDescription reward, Int32 remainingRedemptions, PromotionProcessorContext processorContext)
at EPiServer.Commerce.Marketing.PromotionEngine.Run(IOrderGroup orderGroup, PromotionEngineSettings settings)
at EPiServer.Commerce.Marketing.IPromotionEngineExtensions.Run(IPromotionEngine promotionEngine, IOrderGroup orderGroup)
at AISC.Commerce.Workflow.Activities.CalculateDiscountsVNextActivity.Execute(ActivityExecutionContext executionContext) in C:\w\AISC\AISC.Mediachase.Commerce.Workflow\Activities\OrderGroupActivities\CalculateDiscountsVNextActivity.cs:line 29
at Mediachase.Commerce.WorkflowCompatibility.Activity.Execute()
at Mediachase.Commerce.Engine.ActivityFlowRunner.<>c__DisplayClass15_0`1.b__0()>>
Looking at the stack trace, CalculateAndCommit takes an AffectedEntries argument, but the RewardDescription we return from Evaluate has a null value for AffectedEntries. It's an Order level promotion though, so I'm not sure if that's expected or not. The AffectedOrder and AffectedObject fields are not null on the RewardDescription.
Any thoughts on this? Could it be a bug I need to make a support ticket for?