When executing the pipeline IAssociateCategoryToParentPipeline
, there is a step that checks if there are any validation errors in CommerceContext.GetMessages()
.
This will cause an update to fail even if the messages were in place before the pipeline was initiated, which seems counterintuitive.
Question:
Is there a way to "refresh" the commerce context, or create a clone of it with an empty message list?
Details:
Observed in XC 9.0-Update 1.
AssociateCategoryToParentPipeline
callsAssociateCategoryToParentBlock
, which callCreateRelatationshipCommand
.CreateRelationshipCommand.Process
calls the static methodCommand.PerformTransaction
, and that callsValidatateTransaction
.- ValidationTransaction looks for the existence of a message with a code of "ValidationError", and if one is found, rolls back the transaction. So as long as there are any ValidationErrors in this list, any call to this command, and by extension
AssociateCategoryToParentPipeline
, will fail to persist updates.